Real Software Forums
http://forums.realsoftware.com/

Encoding problem (string in CZ language shows ?)
http://forums.realsoftware.com/viewtopic.php?f=1&t=42532
Page 1 of 1

Author:  Marc [ Fri Feb 03, 2012 12:21 pm ]
Post subject:  Encoding problem (string in CZ language shows ?)

Hy,

I am trying to read and display a CSV textfile that is created by an other program.
The file contains some words from the Czech Republic language
In MS Windows Notepad the file is showed perfect including the special characters.

In my RS project the Czech characters are displayed wrong.
I tried several things with encoding, defineEncoding and convertEncoding
But no good results.

Does anybody know how to solve this?

Author:  trs [ Fri Feb 03, 2012 12:32 pm ]
Post subject:  Re: Encoding problem (string in CZ language shows ?)

Sounds like it is encoding related. As far as I know, RS assumes UTF8 unless otherwise informed.

If you know what encoding the text file is, the following should work:

dim s as string = my_textinputstream.readall
s=DefineEncoding(s,Encodings.whatever)


If you don't know the encoding, the only thing I can think of is try a few more encodings until you get the right one.

Perhaps load the file into a string, break into the debugger, select the string in the debugger and use the debuggers facility to render the string in any encoding to cycle through them until you find the correct one.

Edit: Because Notepad loads it OK, it must know the encoding - what encoding is notepad set to for loading? Is it ANSI? in that case try:

dim s as string = my_textinputstream.readall
s=DefineEncoding(s,Encodings.WindowsANSI)

Author:  Marc [ Fri Feb 03, 2012 12:59 pm ]
Post subject:  Re: Encoding problem (string in CZ language shows ?)

Hi,

If I don't set the encoding, just read it, then it return Code 1536 / "US-ASCII"

dim enc as textencoding
enc = data.Encoding
'breakpoint here view what enc is set to

Author:  Marc [ Fri Feb 03, 2012 1:17 pm ]
Post subject:  Re: Encoding problem (string in CZ language shows ?)

encoding.windowsLatin1 is almost perfect.

Example:
Řetězová pila benzínová (It means something like: Chainsaw on fuel)
But the down-oriënted ^ on R and e are lost.

(I hope the browser shows this characters good :) )

Author:  mjh [ Fri Feb 03, 2012 3:19 pm ]
Post subject:  Re: Encoding problem (string in CZ language shows ?)

ISOLatin2 would be the obvious choice for a Czech text.

Author:  Paulemann [ Sat Feb 04, 2012 8:09 am ]
Post subject:  Re: Encoding problem (string in CZ language shows ?)

Marc wrote:
encoding.windowsLatin1 is almost perfect.

Example:
Řetězová pila benzínová (It means something like: Chainsaw on fuel)
But the down-oriënted ^ on R and e are lost.

(I hope the browser shows this characters good :) )



Řetězová pila benzínová = gasoline Chain Saw
Czech is my native language :wink:

... and ISOLatin2 is right

cu Paul

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/