View Issue Details

IDProjectCategoryView StatusLast Update
0005835JEDI Code LibraryJclUnicodepublic2012-04-19 17:43
ReporterKiriakosAssigned Tooutchy 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product VersionVersion 2.4 
Target VersionFixed in VersionVersion 2.4 
Summary0005835: JclUnicode UnicodeIsWhiteSpace gives different results if UNICODE_RTL_DATABASE is set
DescriptionIf UNICODE_RTL_DATABASE is set UnicodeIsWhiteSpace returns true only for the SeparatorSpace category which excludes control characters ($D, $A etc.). On the other hand if the flag is not set UnicodeIsWhiteSpace returns true for the control characters as well.

Solution

In UnicodeIsWhiteSpace replace
  Result := TCharacter.GetUnicodeCategory(Chr(C)) = TUnicodeCategory.ucSpaceSeparator;

with

  Result := TCharacter.IsWhiteSpace(Chr(C));


Note that TCharacter.IsWhiteSpace is defined as

class function TCharacter.IsWhiteSpace(C: Char): Boolean;
begin
  if IsLatin1(C) then
    Result := (C = ' ') or ((C >= #$0009) and (C <= #$000D)) or (C = #$00A0) or (C = #$0085)
  else
    Result := CheckSeparator(InternalGetUnicodeCategory(UCS4Char(C)));
end;

This should solve Issue 5771 as well and is crucial for the installation of JCLUnicode with the "Unicode RTL database" option.
TagsNo tags attached.
Fixed in GIT commit
Fixed in SVN revision3772
IDE versionDelphi/C++Builder XE2

Activities

outchy

2012-04-08 18:33

administrator   ~0019689

Thanks for this patch, it is committed in revision 3772.

Issue History

Date Modified Username Field Change
2012-03-17 01:23 Kiriakos New Issue
2012-03-17 01:23 Kiriakos IDE version => FPC
2012-04-08 18:33 outchy IDE version FPC => Delphi/C++Builder XE2
2012-04-08 18:33 outchy Note Added: 0019689
2012-04-08 18:33 outchy Assigned To => outchy
2012-04-08 18:33 outchy Status new => feedback
2012-04-19 17:43 outchy Fixed in revision => 3772
2012-04-19 17:43 outchy Status feedback => resolved
2012-04-19 17:43 outchy Fixed in Version => Version 2.4 (Subversion repository/Daily zips)
2012-04-19 17:43 outchy Resolution open => fixed