a tiny question:
I use the Scintilla gadget and with the following code I want to use ASCII or UTF8 encoded files.
Code: Select all
If ReadFile(0, FileName)
FileFormat = ReadStringFormat(0)
ScintillaSendMessage(#ScriptEdit, #SCI_CLEARALL)
While Eof(0) = 0
If FileFormat = #PB_Ascii
*Line = Ascii(ReadString(0, #PB_Ascii) + #CRLF$)
ScintillaSendMessage(#ScriptEdit, #SCI_APPENDTEXT, MemorySize(*Line), *Line)
FreeMemory(*Line)
ElseIf FileFormat = #PB_UTF8
Line = ReadString(0, #PB_UTF8) + #CRLF$
ScintillaSendMessage(#ScriptEdit, #SCI_APPENDTEXT, StringByteLength(Line , #PB_UTF8), UTF8(Line))
EndIf
Wend
ScintillaSendMessage(#ScriptEdit, #SCI_SETSAVEPOINT)
CloseFile(0)
Else
MessageRequester("Important hint", "Can not open file",
#PB_MessageRequester_Ok)
EndIf
Test = "Dies ist ein Tx94x84x81st"
instead
Test = "Dies ist ein Töäüst"
I set the Scintilla gadget to the UTF8 codepage.
ScintillaSendMessage(#ScriptEdit, #SCI_SETCODEPAGE, #SC_CP_UTF8)
Thanks for tips and hints.
Cheers
Stefan