When sending data with winsock, simulating a browser....if i type :
Test Türkçe
my result is:
Test T
This is how winsock treats this string Türkçe : Test+T%FCrk%E7e
So my question is what do i need to do to to change those special chars to be able to send them with winsock so that the other side(server) can recognize them..??
you should optionally search for unisock or uniwinsock control, its a custom control written by a forum member with supports Unicode characters out of the box
Programming is all about good logic. Spend more time here
You will want to use APIs to open and read the files. Give a quick search for this API: CreateFileW. Tha API will open or create files with unicode support. Along with that API, you'll then use these APIs to get the file size, read the file and close the file: GetFileSize, ReadFile, CloseHandle
Insomnia is just a byproduct of, "It can't be done"
Or you can try the FSO, which can read text files as either ANSI or Unicode and probably handles Unicode file names as well.
Assuming any of this really does require Unicode, and isn't just localized ANSI after all.
Tested this, works file:
Code:
Dim FSO As Scripting.FileSystemObject
Dim strName As String
Dim lngCount As Long
Set FSO = New Scripting.FileSystemObject
strName = App.Path & "\Uni" & ChrW$(&H298) & "code.txt"
With FSO.CreateTextFile(strName, True, True)
.Close
End With
MsgBox "Created file"
With FSO.OpenTextFile(strName, ForReading, False, TristateTrue)
Do Until .AtEndOfStream
.ReadLine
lngCount = lngCount + 1
Loop
.Close
End With
MsgBox "Read " & CStr(lngCount) & " lines"
With FSO.OpenTextFile("C:\üÜ çÇ şŞ gG,öÖ.txt", ForReading, False, TristateTrue)
Do Until .AtEndOfStream
.ReadLine
lngCount = lngCount + 1
Loop
.Close
End With
Notice where I used ChrW$() to insert a Unicode character as part of the file name in my example?
A more complete example:
Code:
Option Explicit
'Encoded version of the posted file name:
Private Const UnicodeFileName = _
"\xFC\xDC \xE7\xC7 \u015F\u015E gG,\xF6\xD6.txt"
Private Sub Form_Load()
Dim FSO As Scripting.FileSystemObject
Dim UFN As String
Dim UnicodeText As String
Dim lngCount As Long
Show
Set FSO = New Scripting.FileSystemObject
UnicodeText = UnEsc(UnicodeFileName)
UFN = App.Path & "\" & UnicodeText
With FSO.OpenTextFile(UFN, ForWriting, True, TristateTrue)
.WriteLine UnicodeText
.Close
End With
MsgBox "Created file"
With FSO.OpenTextFile(UFN, ForReading, False, TristateTrue)
Do Until .AtEndOfStream
UnicodeText = .ReadLine()
lngCount = lngCount + 1
Loop
.Close
End With
MsgBox "Read " & CStr(lngCount) & " lines"
'Note that TextBox controls only accept ANSI so VB will perform
'implicit conversion from Unicode to ANSI here.
Text1.Text = UnicodeText
'Since TextBox controls only contain ANSI, VB will convert back
'to Unicode when retrieving values. However these conversions are
'not lossless so this comparison can fail!
MsgBox "Text1.Text == UnicodeText? " & CStr(Text1.Text = UnicodeText)
'Here we use a Unicode-aware Forms 2.0 TextBox control. No such
'translation issue here, however the Forms 2.0 Library has
'redistribution and other issues, so we rarely use it in real
'programs.
TextBox1.Text = UnicodeText
MsgBox "TextBox1.Text == UnicodeText? " & CStr(TextBox1.Text = UnicodeText)
End Sub
This example shows how two String values can look the same but not be the same.