Yes, i know that character can have severals code identification, like ASCII ou Unicode.
but Chr() is for ASCII and your code doesn't works for me...
In fact, i want to read text from a file (UTF8) and display it.
But, if file contains euro character, for exemple, the display is not correct with editorgadget.
I thought for a bug, because just some chars are not correctrly displayed.
and i wasn't been able to correct it.
Now, i have found a method in end of this code.
thanks
Code: Select all
If CreateFile(0, "D:\Test.txt")
WriteString( 0, Chr(128), #PB_UTF8 )
CloseFile(0)
EndIf
Delay(100)
If ReadFile(0, "D:\Test.txt")
F$ = ReadString( 0, #PB_UTF8)
CloseFile(0)
EndIf
If OpenWindow(0, 0, 0, 322, 150, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
EditorGadget(0, 8, 8, 306, 133)
A$ = Chr(8364) + Chr(128) + Chr(65)
Debug PeekW(@A$ ) ; => 172 and not 8364
Debug PeekW(@A$+2 ) ; => 128
Debug PeekW(@A$+4 ) ; => 65
SetGadgetText(0,A$ +#CRLF$+F$)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
; To convert ASCII to Unicode
; C$ = " "
; PokeW(@C$,8364)
; A$ = ReplaceString( A$, Chr(128), PeekS(@C$,1) )
; SetGadgetText( A$ )