txt files and codepages

sum

New Member
I have a txt file containing national characters (Umlauts).
If reading in that file with:

FileOpen(MyFile,"some.txt",cRead)
...
s = FileRead(MyFile)

national characters are replaced with a question mark character.

How kann I read the file correctly.

I think somehow the encoding (Codepage,"ISO-8859_1") of the file should be specified.
Any ideas?
 
You should use the CodepageFile object in the BytesConverter library.
You appear as an unlicensed user so I don't remember if this library is in the demo program.
Additional libraries are only accessible for users who baught B4PPC.

Best regards.
 
If you can't access my BytesConverter library you can do it a longer way round with the BinaryFile library which I think is available in the trial edition.

You open the BinaryFile with New2 passing it a files opened as Random. Dim a byte array with Length and read the bytes into it with ReadBytes. BytesToString then gets you a Unicode string to use in B4P that is converted from the format that you specified when you opened. The int value to pass for ISO-8859-1 is 28591.
 
Testing this ..

Hi i also have that problem but with swedish letters.

i have this code that works for all letters but not for "åäö and ÅÄÖ".

barray = conv.StringToBytes(Txtut.Text,"UTF-8")
DataToSend = conv.HexFromBytes (barray)

How can i do do make it work ??

Br
Nizze
 
Back
Top