[fpc-pascal] Re: Console Encoding in Windows (Local VS. UTF8)

Noah Silva shiruba at galapagossoftware.com
Sun Jul 14 02:28:55 CEST 2013


Hi,

Thank you very much for the link.

I think it will take some experimenting to get everything to work how it
should on my systems.

I am not using the {$codepage utf8} in my files, but I don't usually have
any non-ASCII text in the programs.  (The source files are in UTF8 though).
 The data I am loading is loaded from database, text files, etc.  I am sure
it(s not corrupted in memory, because I can write it back out to text
files, store it in the database, or even view it in the debugger.

The SetColsoleOutputCP is probably what I tried before that caused the
Windows Console to act strange.

What's worse, adding UTF8ToANSI not only didn't fix the problem on Windows,
it broke MacOS (because console on OS X is always UTF8, but ANSI encoding
still exists, so it(s not a noop).

thank you,
    Noah Silva




2013/7/9 Reinier Olislagers <reinierolislagers at gmail.com>

> On 9-7-2013 11:02, Noah Silva wrote:
> > I have followed steps in the Wiki, etc., but to little avail, so I have
> > some questions for anyone who knows more than me:
> > 1. What encoding "should" I be writing to the terminal?  from
> > experimenting with text files using the cat command in powershell, it
> > seems that local ("ANSI") encoding should be used.  This makes sense
> > since older versions of windows only supported local encodings.
> > 2. Is there any reason why writing out data in the local encoding (with
> > write statements, etc.) should get corrupted?  For example is some level
> > of the RTL assuming something about the encoding? (I don't think so,
> but...)
> > 3. Is there a way to set the output to UTF8 so I can just write out UTF8
> > and be done with it?
> >
> > Just to give an example:
> > 1. I read in an SJIS CSV file, and display it on the screen, and it's
> > corrupted.
> > 2. I convert it to UTF8 before displaying it, and it's still corrupted.
> > 3.I cat the file to the screen and it's ok.
> > 4. I write the output to a file instead of the console, and it's ok.
> >
> > Something seems odd.
> >
> > Does anyone else have these issues?
> Yes.
>
> See:
> http://bugs.freepascal.org/view.php?id=22461
> for info on the situation in FPC trunk.
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130714/f16933dd/attachment.html>


More information about the fpc-pascal mailing list