- Thierry Del Fiore
- PowerBuilder
- Monday, 4 May 2020 08:32 AM UTC
Hi,
We need to read text files in linemode with fileopen() and filereadex()
We use fileencoding() before fileopen() in order to find out the encoding argument (EncodingANSI!, EncodingUTF8!, ...)
We have an issue with UTF8 files.
FileEncoding() returns ANSI for UTF8 file.
Fileopen() with EncodingUTF8! argument returns -1 for UTF8 files.
So we open the file in ANSI, but in this case we have accent character issue : èéàùê becomes èéà ùê
The only way to have the correct string is to convert : string(blob(ls_line, encodingansi!), encodingutf8!)
But we cannot always do the conversion because if the text file is really in ANSI, we get asian character.
So, the question is : how can we handle both ANSI and UTF8 files since FileEncoding() always returns ANSI ?
is this a Powerbuilder Bug ?
Regards
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.