<div dir="ltr"><div class="gmail_extra">Hi,<div><br></div><div>This answer is a bit late, but...</div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/7/9 Dennis Poon <span dir="ltr"><<a href="mailto:dennis@avidsoft.com.hk" target="_blank">dennis@avidsoft.com.hk</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im"><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
I have followed steps in the Wiki, etc., but to little avail, so I have some questions for anyone who knows more than me:<br>...<span style="color:rgb(34,34,34)"> </span></blockquote></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">...<span style="color:rgb(34,34,34)"> </span></blockquote>
</div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
4. I write the output to a file instead of the console, and it's ok.<br></blockquote><br></div>Please state the windows version you are using. XP or Windows 7?</blockquote><div><br></div><div>Windows 7, but there isn't any difference in this case.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> I deal with chinese in my programs so I know your problems. The same delphi 5 program works differently on XP and Windows 7. Looks like Windows 7 has removed support for non unicode (I am not sure whether the Unicode it uses is UTF8, UTF16 or UTF32).<br>
<br></blockquote><div>When you say "removed support", what specifically are you talking about ? They both use the NT kernel and so use UTF16 most everywhere internally, but the assume that most programs use local encodings.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Seems that all filenames in XP are treated as unicode code. If you type a non unicode file name in Explorer, it will be auto converted to unicode.<br>
</blockquote><div><br></div><div>Filenames as accessed from where? Filenames in NTFS are always stored in Unicode, so far as I know. When you enter a file name in Explorer, how do you know if it is being entered in Unicode or not? Basically, explorer is probably a Unicode-aware program (so far as I know), so I would assume any text you enter starts life as Unicode via the IME.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Also, in XP, when text is copied to MS Office from other programs and vice versa, XP seems to do an automatic conversion to UTF-8 and vice versa.<br>
</blockquote><div><br></div><div>MS Office is also of course Unicode Aware, and the newer XML file formats they use save everything as as Unicode to the best of my knowledge. When importing/exporting text files, clipboard, etc., they will use the local encoding for most things.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">That is if you copy some text in your program which is encoding in SJIS and paste it to Word, the text seems to be auto converted to unicode.<br>
<br></blockquote><div>Seems reasonable.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">As for file handling, it seems some programs will read the first 2 bytes of the text file to determine the the encoding of the file. Google about it.<br>
</blockquote><div><br></div><div>This is well known, though many programs use much more than 2 bytes in order to guess if there is no BOM. Though Microsoft's guessing algorithm is rather entertaining at times.</div><div>
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Sorry, I don't have exact answers to your questions. Just share some of my experience.<span class=""><font color="#888888"><br>
<br></font></span></blockquote><div> </div><div>Well certainly the more the merrier, other people who search this list may benefit from your comments even if they aren't relevant to my case.</div><div><br></div><div>My problem is this:</div>
<div>I want to output text to the console and have it not be corrupted. I have the text in my program as UTF8, but when I write it to the console, it shows corrupted garbage. This happens whether I write it out as UTF8 or ANSI (SJIS). Since the console basically works with local encoding, it should work when I use UTF8ToAnsi to convert the text before writing it, but it doesn't. </div>
<div><br></div><div>Since it works with other programs and things like the "type" command, it occurred to be that it might be a FPC issue, or that I might be interfering with some built-in auto-conversion feature (which is why I tried to output as UTF8 as well).</div>
<div><br></div><div>I'll figure it out eventually, though.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<span class=""><font color="#888888">Dennis</font></span><div class=""><div class="h5"><br></div></div></blockquote><div><br></div><div>Thank you,</div><div> Noah Silva </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class=""><div class="h5">______________________________<u></u>_________________<br>fpc-pascal maillist - <a href="mailto:fpc-pascal@lists.freepascal.org" target="_blank">fpc-pascal@lists.freepascal.<u></u>org</a><br>
<a href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal" target="_blank">http://lists.freepascal.org/<u></u>mailman/listinfo/fpc-pascal</a><br></div><div><br></div></div></blockquote></div></div></div></div>