<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 20.08.2012 14:03, Martin Schreiber wrote:
<blockquote cite="mid:201208201303.35735.mse00000@gmail.com"
type="cite">
<pre wrap="">On Monday 20 August 2012 12:37:24 Anton Kavalenka wrote:
</pre>
<blockquote type="cite">
<pre wrap="">
Since the beginning of my FPC use I maintain the following FPC/Delphi
compatible code.
</pre>
</blockquote>
<pre wrap="">Does it work if the source has been compiled with -Fcutf8 on Windows? IIRC FPC
converts the source utf8 constants to the system encoding before building the
resource string tables. Another question is the encoding of the *.rst files
we need in the MSEi18n tool.
Martin
_______________________________________________
fpc-devel maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freepascal.org/mailman/listinfo/fpc-devel">http://lists.freepascal.org/mailman/listinfo/fpc-devel</a>
</pre>
</blockquote>
<font face="Liberation Sans">I use separate include files for
resource strings in UTF-8 and in win1251.</font><br>
<br>
{$ifdef FPC}<br>
{$i resources-utf8.inc}<br>
{$else}<br>
{$i resources-cp1251.inc}<br>
{$endif}<br>
<br>
IIRC FPC does NOT convert resource strings into system encoding.<br>
<br>
Besides my applications use FPC runtime to extract own
resorcestrings into external files (for translation).<br>
<br>
<tt>procedure ExtractStringResources;<br>
var<br>
os:TFileStream;<br>
begin<br>
if not FileExists(DefLocalesPath) then
CreateDir(DefLocalesPath);<br>
os:=TFileStream.Create(DefLocalesPath+PathDelim+ExtractFileName(ParamStr(0))+'.fpcres',fmCreate);<br>
try<br>
SetResourceStrings(@DoSaveStringResource,os);<br>
finally<br>
os.Free;<br>
end;<br>
end;<br>
</tt><br>
<tt>function
DoSaveStringResource(Name,Value:AnsiString;Hash:Longint;arg:pointer):AnsiString;<br>
var<br>
os:TStream absolute arg;<br>
begin<br>
Result:='';<br>
os.WriteBuffer(Hash,sizeof(Hash));<br>
os.WriteAnsiString(Value);<br>
end;<br>
</tt><br>
Resources from both Windows and Linux EXE are extracted in UTF-8
(not win1251).<br>
<br>
Anton<br>
</body>
</html>