|
@@ -22,9 +22,16 @@ unit UTF8Utils;
|
|
|
{$WARN 6058 off : Call to subroutine "$1" marked as inline is not inlined}
|
|
|
{$ENDIF}
|
|
|
|
|
|
+{$IFNDEF fpc_unicodestrings}
|
|
|
+ {$DEFINE UTF8_RTL}
|
|
|
+{$ENDIF}
|
|
|
+
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
+ {$IFDEF Unix}
|
|
|
+ cwstring,
|
|
|
+ {$ENDIF}
|
|
|
{$ifdef windows}
|
|
|
Windows,
|
|
|
{$endif}
|
|
@@ -190,8 +197,6 @@ var
|
|
|
|
|
|
implementation
|
|
|
|
|
|
-
|
|
|
-
|
|
|
{$IFDEF WinCE}
|
|
|
// CP_UTF8 is missing in the windows unit of the Windows CE RTL
|
|
|
const
|
|
@@ -4055,8 +4060,18 @@ begin
|
|
|
FPUpChars[c]:=UpCase(c);
|
|
|
end;
|
|
|
|
|
|
+procedure InitUTF8;
|
|
|
+begin
|
|
|
+ {$ifdef UTF8_RTL}
|
|
|
+ SetMultiByteConversionCodePage(CP_UTF8);
|
|
|
+ // SetMultiByteFileSystemCodePage(CP_UTF8); not needed, this is the default under Windows
|
|
|
+ SetMultiByteRTLFileSystemCodePage(CP_UTF8);
|
|
|
+ {$ENDIF}
|
|
|
+end;
|
|
|
|
|
|
initialization
|
|
|
InitFPUpchars;
|
|
|
+ InitUTF8;
|
|
|
+
|
|
|
end.
|
|
|
|