aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-07-23 19:30:21 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-07-23 19:30:21 +0000
commit299bf6294787743434bccd22c165e94b1b8ce5d5 (patch)
tree6b781de9ab2b68587518cde0001ba076744028d6
parent14cc4aa3f5db2d0f02e59c9e0889c30418ea6638 (diff)
downloadusdx-299bf6294787743434bccd22c165e94b1b8ce5d5.tar.gz
usdx-299bf6294787743434bccd22c165e94b1b8ce5d5.tar.xz
usdx-299bf6294787743434bccd22c165e94b1b8ce5d5.zip
WideStringLower/UpperCase on unix uses WideLower/UpperCase from cwstring again instead of the simple ASCII Lower/UpperCase version
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1893 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r--unicode/src/base/UUnicodeUtils.pas35
1 files changed, 26 insertions, 9 deletions
diff --git a/unicode/src/base/UUnicodeUtils.pas b/unicode/src/base/UUnicodeUtils.pas
index 29be778a..88b1be4b 100644
--- a/unicode/src/base/UUnicodeUtils.pas
+++ b/unicode/src/base/UUnicodeUtils.pas
@@ -166,9 +166,9 @@ function UTF8Copy(const str: UTF8String; Index: Integer = 1; Count: Integer = -1
function UCS4Copy(const str: UCS4String; Index: Integer = 0; Count: Integer = -1): UCS4String;
(*
- * Converts a WideString to its upper-case representation.
- * Wrapper for WideUpperCase. Needed because some plattforms have problems with
- * unicode support.
+ * Converts a WideString to its upper- or lower-case representation.
+ * Wrapper for WideUpper/LowerCase. Needed because some plattforms have
+ * problems with unicode support.
*
* Note that characters in UTF-16 might consist of one or two WideChar valus
* (see surrogates). So instead of using WideStringUpperCase(ch)[1] for single
@@ -177,6 +177,8 @@ function UCS4Copy(const str: UCS4String; Index: Integer = 0; Count: Integer = -1
*)
function WideStringUpperCase(const str: WideString) : WideString; overload;
function WideStringUpperCase(ch: WideChar): WideString; overload;
+function WideStringLowerCase(const str: WideString): WideString; overload;
+function WideStringLowerCase(ch: WideChar): WideString; overload;
function StringReplaceW(const text : WideString; search, rep: WideChar): WideString;
@@ -501,8 +503,7 @@ end;
function UTF8LowerCase(const str: UTF8String): UTF8String;
begin
- // FIXME
- Result := UTF8Encode(WideLowerCase(UTF8Decode(str)));
+ Result := UTF8Encode(WideStringLowerCase(UTF8Decode(str)));
end;
function UCS4UpperCase(ch: UCS4Char): UCS4Char;
@@ -608,13 +609,29 @@ begin
// Otherwise you will get an EIntOverflow exception (thrown by unimplementedwidestring()).
// The Unicode manager cwstring does not work with MacOSX at the moment because
// of missing references to iconv.
+ // Note: Should be fixed now
{.$IFNDEF DARWIN}
- {$IFDEF NOIGNORE}
+ {.$IFDEF NOIGNORE}
Result := WideUpperCase(str)
- {$ELSE}
- Result := UTF8Decode(UpperCase(UTF8Encode(str)));
- {$ENDIF}
+ {.$ELSE}
+ //Result := UTF8Decode(UpperCase(UTF8Encode(str)));
+ {.$ENDIF}
+end;
+
+function WideStringLowerCase(ch: WideChar): WideString;
+begin
+ // see WideStringUpperCase
+ if (ch = #0) then
+ Result := #0
+ else
+ Result := WideStringLowerCase(WideString(ch));
+end;
+
+function WideStringLowerCase(const str: WideString): WideString;
+begin
+ // see WideStringUpperCase
+ Result := WideLowerCase(str)
end;
function StringReplaceW(const text : WideString; search, rep: WideChar) : WideString;