aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/base/UUnicodeUtils.pas25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/base/UUnicodeUtils.pas b/src/base/UUnicodeUtils.pas
index 37b53a67..52e40847 100644
--- a/src/base/UUnicodeUtils.pas
+++ b/src/base/UUnicodeUtils.pas
@@ -186,6 +186,9 @@ function WideStringLowerCase(ch: WideChar): WideString; overload;
function WideStringReplaceChar(const text: WideString; search, rep: WideChar): WideString;
+function AnsiToAscii(const s:AnsiString):AnsiString;
+function AsciiToAnsi(const s:AnsiString):AnsiString;
+
implementation
{$IFDEF UNIX}
@@ -664,6 +667,28 @@ begin
end;
end;
+function AnsiToAscii(const s:AnsiString):AnsiString;
+begin
+ Result := s;
+
+ if Result <> '' then
+ begin
+ UniqueString(Result);
+ CharToOem(Pchar(Result), Pchar(Result));
+ end;
+end;
+
+function AsciiToAnsi(const s:AnsiString):AnsiString;
+begin
+ Result := s;
+
+ if Result <> '' then
+ begin
+ UniqueString(Result);
+ OemToChar(Pchar(Result), Pchar(Result));
+ end;
+end;
+
initialization
InitUnicodeUtils;