Skip to content

Commit

Permalink
Merge pull request #890 from UltraStar-Deluxe/more_unicode_support
Browse files Browse the repository at this point in the history
Improve check for alphabetic characters.
  • Loading branch information
barbeque-squared authored Sep 11, 2024
2 parents e1bcb4b + 12c9106 commit d816e69
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions src/base/UUnicodeUtils.pas
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ interface
uses
{$IFDEF MSWINDOWS}
Windows,
{$ELSE}
Character, // Include the Character unit for non-Windows platforms
{$ENDIF}
anyascii,
StrUtils,
Expand Down Expand Up @@ -238,20 +240,11 @@ function IsNativeUTF8(): boolean;
function IsAlphaChar(ch: WideChar): boolean;
begin
{$IFDEF MSWINDOWS}
// On Windows, IsCharAlphaW() handles Unicode characters correctly for all languages.
Result := IsCharAlphaW(ch);
{$ELSE}
// TODO: add chars > 255 (or replace with libxml2 functions?)
case ch of
'A'..'Z', // A-Z
'a'..'z', // a-z
#170,#181,#186,
#192..#214,
#216..#246,
#248..#255:
Result := true;
else
Result := false;
end;
// Use the TCharacter helper to check for any alphabetic character in Unicode
Result := TCharacter.IsLetter(ch);
{$ENDIF}
end;

Expand Down

0 comments on commit d816e69

Please sign in to comment.