تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
مفكرتي لا تدعم الحفظ باللغة العرببة UTF8
#1
لقد قمت بعمل مفكرة 
المشكلة انها تكتب بالعربية لكن الحفظ تحفظها بشكل استفهامات ورموز
وعند فتح ملف تكست عربي حارجي يقع معي نفس المشكلة
Angel  الحياة فترة اختبار , إما أن تكون او لاتكون  Rolleyes  
لن امل من البحث  ولن امل من السؤال
[b]رواد المعلوميات[/b]
الرد }}}
تم الشكر بواسطة:
#2
أضف الترميز System.Text.Encoding.UTF8 سواء استخدمت New IO.StreamWriter أو IO.File.WriteAllText
الرد }}}
#3
السلام عليكم اخي رائد
ان كنت تستخدم قواعد البيانات من نوع SqlServer
انظر الى الصورة المرفقة واختر التنسيق Arabic_CI_AI


الملفات المرفقة صورة/صور
   
اعمل الخير وأجرك لا تنتظره فالله خير من إليك يرده
البرمجة ليست مجرد كود بل هي منهج تفكير منطقي لحل المشكلات







الرد }}}
#4
(14-08-19, 09:08 PM)ابراهيم ايبو كتب :
السلام عليكم اخي رائد
ان كنت تستخدم قواعد البيانات من نوع SqlServer
انظر الى الصورة المرفقة واختر التنسيق Arabic_CI_AI

لااستخدم اي قاعدة بيانات 
لقد قمت بصناعة برنامج مفكرة Notpad  لكن حين أقوم بتخزين النص المكتوب بالعربية يظهر لي على شكل استفهامات 
وهذا هو الكود المنجز في هذه المفكرة 
علما انني اقوم بالحفظ بصيغة txt وrich Sad
كود :
Public Class add_memo
   Dim I As Integer = 1
   Dim drag As Boolean
   Dim y As Integer
   Dim x As Integer
   Sub sorte()
       Try
           Dim msg As String
           Dim title As String
           Dim style As MsgBoxStyle
           Dim response As MsgBoxResult
           msg = "Are you sure?"   ' shows your message you can change it
           style = MsgBoxStyle.Information Or _
               MsgBoxStyle.YesNo 'The dialog will be a Yes No answer
           title = "Youtite"   ' What did you name you application?
           response = MsgBox(msg, style, title)
           If response = MsgBoxResult.Yes Then   ' if the user chooses Yes it is going to execute the Me.Close() which will close the programme
               'Else it will still show up.
               Me.Close()
           Else
               Me.Show()
           End If
       Catch ex As Exception

       End Try

   End Sub
   Sub clearrtab()
       Try
           If TabControl1.TabCount = 1 Then
               MsgBox("Error You Can't Remove The Last Page", MsgBoxStyle.Critical)
               'Now you can change the message to whatever you like
               'This code will not allow us to remove the last tabpage which automatically loads
               'If it did an error would occur.

               Exit Sub
           Else

           End If

           TabControl1.TabPages.RemoveAt(TabControl1.SelectedIndex)
           'This bottom code is telling it to remove the selected tab and countdown minus (-) 1 (one)
           TabControl1.SelectTab(TabControl1.TabPages.Count - 1)
           I = I - 1
       Catch ex As Exception

       End Try

   End Sub
   Sub savve()
       Try
           Dim SaveFileDialog1 As New SaveFileDialog
           SaveFileDialog1.Filter = "Rich Text Files|*.rtf|Text Files|*.txt"
           SaveFileDialog1.ShowDialog()
           FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output)
           PrintLine(1, CType(TabControl1.SelectedTab.Controls.Item(0), RichTextBox).Text)
           FileClose(1)
       Catch ex As Exception

       End Try

   End Sub
   Sub editt()
       Dim Edit As New RichTextBox
       TabControl1.TabPages.Add(1, "صفحة " & I)
       TabControl1.SelectTab(I - 1)
       Edit.Name = "TE"
       Edit.Dock = DockStyle.Fill
       TabControl1.SelectedTab.Controls.Add(Edit)
       I = I + 1
   End Sub
   Sub openn()
       Dim OpenFileDialog1 As New OpenFileDialog
       Dim AllText As String = "", LineOfText As String = ""
       'This bottom code is telling it to search each and ever file type
       OpenFileDialog1.Filter = "All Files|*.*"
       'This bottom code basically shows the opendialog box
       OpenFileDialog1.ShowDialog()
       Try
           FileOpen(1, OpenFileDialog1.FileName, OpenMode.Input)
           Do Until EOF(1)
               LineOfText = LineInput(1)
               AllText = AllText & LineOfText & vbCrLf
           Loop
           CType(TabControl1.SelectedTab.Controls.Item(0), RichTextBox).Text = AllText
       Catch

       Finally
           FileClose(1)
       End Try
   End Sub
   Private Sub add_memo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       editt()
   End Sub

   Private Sub ملفنصيجديدToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ملفنصيجديدToolStripMenuItem.Click
       editt()
   End Sub

   Private Sub حذفالتبويبToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles حذفالتبويبToolStripMenuItem.Click
       clearrtab()
   End Sub

   Private Sub فتحملفخارجيToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles فتحملفخارجيToolStripMenuItem.Click
       openn()
   End Sub

   Private Sub حفظفيملفنصيToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles حفظفيملفنصيToolStripMenuItem.Click
       savve()
   End Sub

   Private Sub خروجToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles خروجToolStripMenuItem.Click
       sorte()
   End Sub

   Private Sub تحديدالخطToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles تحديدالخطToolStripMenuItem.Click
       If TabControl1.TabCount = 0 Then
       End If
       Dim FS As New FontDialog
       FS.ShowDialog()
       CType(TabControl1.SelectedTab.Controls.Item(0), RichTextBox).Font = FS.Font
   End Sub

   Private Sub الألوانToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles الألوانToolStripMenuItem.Click
       If TabControl1.TabCount = 0 Then
       End If
       Dim FC As New ColorDialog
       FC.ShowDialog()
       CType(TabControl1.SelectedTab.Controls.Item(0), RichTextBox).ForeColor = FC.Color

   End Sub

   Private Sub حولالبرنامجToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
   End Sub

   Private Sub ToolStripButton9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton9.Click
       editt()
   End Sub

   Private Sub ToolStripButton10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton10.Click
       If TabControl1.TabCount = 1 Then
           MsgBox("Error You Can't Remove The Last Page", MsgBoxStyle.Critical)
           'Now you can change the message to whatever you like
           'This code will not allow us to remove the last tabpage which automatically loads
           'If it did an error would occur.

           Exit Sub
       Else

       End If

       TabControl1.TabPages.RemoveAt(TabControl1.SelectedIndex)
       'This bottom code is telling it to remove the selected tab and countdown minus (-) 1 (one)
       TabControl1.SelectTab(TabControl1.TabPages.Count - 1)
       I = I - 1
   End Sub

   Private Sub ToolStripButton11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton11.Click
    openn()
   End Sub


   Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
       CType(TabControl1.SelectedTab.Controls.Item(0), RichTextBox).Redo()
   End Sub

   Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click
       CType(TabControl1.SelectedTab.Controls.Item(0), RichTextBox).Undo()
   End Sub

   Private Sub ToolStripButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton3.Click
       CType(TabControl1.SelectedTab.Controls.Item(0), RichTextBox).Cut()
   End Sub

   Private Sub ToolStripButton4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton4.Click
       CType(TabControl1.SelectedTab.Controls.Item(0), RichTextBox).Copy()
   End Sub

   Private Sub ToolStripButton5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton5.Click
       CType(TabControl1.SelectedTab.Controls.Item(0), RichTextBox).Paste()
   End Sub

   Private Sub ToolStripButton6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton6.Click
       CType(TabControl1.SelectedTab.Controls.Item(0), RichTextBox).Text = ""
   End Sub

   Private Sub ToolStripButton7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton7.Click
       CType(TabControl1.SelectedTab.Controls.Item(0), RichTextBox).SelectAll()
   End Sub

   Private Sub ToolStripButton8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton8.Click
       CType(TabControl1.SelectedTab.Controls.Item(0), RichTextBox).Clear()
   End Sub

   Private Sub خلفيةالمفكرةToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles خلفيةالمفكرةToolStripMenuItem.Click
       If TabControl1.TabCount = 0 Then
       End If
       Dim FC As New ColorDialog
       FC.ShowDialog()
       CType(TabControl1.SelectedTab.Controls.Item(0), RichTextBox).BackColor = FC.Color
   End Sub

   Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
       Me.WindowState = FormWindowState.Minimized
   End Sub

   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       sorte()
       'Me.Close()
       MAIN.Show()
   End Sub

   Private Sub ToolStripButton12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton12.Click
       savve()
   End Sub

   Private Sub MenuS1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MenuS1.MouseDown
       drag = True
       x = Cursor.Position.X - Me.Left
       y = Cursor.Position.Y - Me.Top
   End Sub

   Private Sub MenuS1_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MenuS1.MouseUp
       drag = False
   End Sub

   Private Sub MenuS1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MenuS1.MouseMove
       If drag = True Then
           Me.Left = Cursor.Position.X - x
           Me.Top = Cursor.Position.Y - y
       End If
   End Sub
End Class
Angel  الحياة فترة اختبار , إما أن تكون او لاتكون  Rolleyes  
لن امل من البحث  ولن امل من السؤال
[b]رواد المعلوميات[/b]
الرد }}}
تم الشكر بواسطة: ابراهيم ايبو , asemshahen5
#5
بالنسبة  System.Text.Encoding.UTF8 صراحة لم استخدمها من قبل 
اتمنى من الاستاد العزيز Beginer توضيح الامر وكبفية الاستخدام  لتعم الفائدة
اعمل الخير وأجرك لا تنتظره فالله خير من إليك يرده
البرمجة ليست مجرد كود بل هي منهج تفكير منطقي لحل المشكلات







الرد }}}
تم الشكر بواسطة: mohamedahmed1 , asemshahen5
#6
من أجل العم ابراهيم
هذا التعديل فيه كيفية استخدام System.Text.Encoding.UTF8

تعديل الكود savve
PHP كود :
Sub savve()
 
   Try
        Dim SaveFileDialog1 
As New SaveFileDialog
        SaveFileDialog1
.Filter "Rich Text Files|*.rtf|Text Files|*.txt"
 
       SaveFileDialog1.ShowDialog()
 
       IO.File.WriteAllText(SaveFileDialog1.FileNameCType(TabControl1.SelectedTab.Controls.Item(0), RichTextBox).TextSystem.Text.Encoding.UTF8)
 
   Catch ex As Exception

    End 
Try

End Sub 

تعديل الكود openn
PHP كود :
Sub openn()
 
   Dim OpenFileDialog1 As New OpenFileDialog
    Dim AllText 
As String ""LineOfText As String ""
 
   'This bottom code is telling it to search each and ever file type
    OpenFileDialog1.Filter = "Rich Text Files|*.rtf|Text Files|*.txt"
    '
This bottom code basically shows the opendialog box
    OpenFileDialog1
.ShowDialog()
 
   Try
        CType
(TabControl1.SelectedTab.Controls.Item(0), RichTextBox).Text IO.File.ReadAllText(OpenFileDialog1.FileNameSystem.Text.Encoding.UTF8)
 
   Catch

    Finally

    End 
Try
End Sub 
الرد }}}
#7
(14-08-19, 10:34 PM)Beginer كتب : من أجل العم ابراهيم
هذا التعديل فيه كيفية استخدام System.Text.Encoding.UTF8

تعديل الكود savve
PHP كود :
Sub savve()
 
   Try
        Dim SaveFileDialog1 
As New SaveFileDialog
        SaveFileDialog1
.Filter "Rich Text Files|*.rtf|Text Files|*.txt"
 
       SaveFileDialog1.ShowDialog()
 
       IO.File.WriteAllText(SaveFileDialog1.FileNameCType(TabControl1.SelectedTab.Controls.Item(0), RichTextBox).TextSystem.Text.Encoding.UTF8)
 
   Catch ex As Exception

    End 
Try

End Sub 

تعديل الكود openn
PHP كود :
Sub openn()
 
   Dim OpenFileDialog1 As New OpenFileDialog
    Dim AllText 
As String ""LineOfText As String ""
 
   'This bottom code is telling it to search each and ever file type
    OpenFileDialog1.Filter = "Rich Text Files|*.rtf|Text Files|*.txt"
    '
This bottom code basically shows the opendialog box
    OpenFileDialog1
.ShowDialog()
 
   Try
        CType
(TabControl1.SelectedTab.Controls.Item(0), RichTextBox).Text IO.File.ReadAllText(OpenFileDialog1.FileNameSystem.Text.Encoding.UTF8)
 
   Catch

    Finally

    End 
Try
End Sub 

شكرا لك كثير أيها المحترم , لقد حلت المشكلة نهائيا
Angel  الحياة فترة اختبار , إما أن تكون او لاتكون  Rolleyes  
لن امل من البحث  ولن امل من السؤال
[b]رواد المعلوميات[/b]
الرد }}}
تم الشكر بواسطة: asemshahen5
#8
شكرا صديقي الغالي Beginer
اعمل الخير وأجرك لا تنتظره فالله خير من إليك يرده
البرمجة ليست مجرد كود بل هي منهج تفكير منطقي لحل المشكلات







الرد }}}



التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم