<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><br>
</p>
<div class="moz-cite-prefix"><br>
</div>
<blockquote type="cite"
cite="mid:3de78103241caaeb1eb6af2e7090a7e4@hajny.biz"><br>
<blockquote type="cite">
<blockquote type="cite">You may be able to improve on this using
system.BlockRead.
<br>
</blockquote>
Probably yes, but then I must read in local buffer and examine
buffer for CR/LF.
<br>
<br>
And return from my function UCS2ReadLn() only portion of string
up to
<br>
CR/LF and rest of string return on next call to my function.
<br>
(so I must keep unprocessed part in global buffer)
<br>
<br>
<br>
<blockquote type="cite">Also, you are assuming low order byte
first which may not be portable.
<br>
</blockquote>
<br>
Yes, In my case LE is sufficient as far as I check presence of
BOM $FF$FE
<br>
</blockquote>
<br>
Just as a comment - a contribution allowing ReadLn to read UTF-16
files (preferably complete from functional point of view,
especially without shortcuts like handling only UCS2 instead of
complete Unicode) would be obviously welcome.
<br>
</blockquote>
<p><br>
</p>
<p>Is there consensus/demand on such solution and any patch in this
direction will be accepted?<br>
If yes we must agree on implementation details and IMO also
someone must check what situation is in Delphi ... because I
guess, that if Delphi does not support this that also FPC will not
diverge?<br>
Question1: should be supported "SetTextCodePage(CP_UTF16)<a
class="mw-selflink selflink">"</a> and <a class="mw-selflink
selflink">"</a><a class="mw-selflink selflink">SetTextCodePage(CP_UTF16BE)"?<br>
Question2: is this supported in Delphi?<br>
If answer to both questions is YES then I will fill bug report
as start point.<br>
</a></p>
<p>As I wrote there is in sources explicit comment: "// all standard
input is assumed to be ansi-encoded" which will be no more true if
we will add UTF-16 support.</p>
<p>I can imagine, that we can add check for
TextRec(T).CodePage=CP_UTF16 and CP_UTF16BE and these two
situations handle specially (in read and also in write procedures
of text files)</p>
<p>But as far as Read[Ln]/Write[Ln] is core functionality I think,
that somebody of core developers should look at it ... ;-)<br>
</p>
<p>-Laco.</p>
<br>
</body>
</html>