From 32f1bc3d4a1e74e2e3c0f3c48a616e2dc21b1ac6 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sun, 3 Jan 2016 18:39:21 +0000 Subject: add AnsiToAscii and AsciiToAnsi. Unused so far git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@3173 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/base/UUnicodeUtils.pas | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src') 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; -- cgit v1.2.3