lazutf8: GetFormatSettingsUTF8: map common multibyte chars to ASCII

git-svn-id: trunk@47890 -
This commit is contained in:
mattias 2015-02-18 19:51:28 +00:00
parent 22a79968ee
commit e1e00306cf
2 changed files with 30 additions and 2 deletions

View File

@ -19,7 +19,7 @@ unit LazUTF8;
{$mode objfpc}{$H+}{$inline on}
{$IF defined(EnableUTF8RTL) and (FPC_FULLVERSION<20701)}
{$error UTF8 RTl requires fpc 2.7.1+}
{$error UTF8 in RTL requires fpc 2.7.1+}
{$ENDIF}
interface

View File

@ -354,8 +354,36 @@ begin
if (GetLocaleInfoA(aLocaleID, aLCType, Buf, sizeof(buf)) > 0)
and (ord(Buf[0])<128) then
Result := Buf[0]
else
else begin
Result := Def;
case Buf[0] of
#$C2:
case Buf[1] of
#$A0: Result:=' '; // non breakable space
#$B7: Result:='.'; // middle stop
end;
#$CB:
if Buf[1]=#$99 then Result:=''''; // dot above, italian handwriting
#$D9:
case Buf[1] of
#$AB: Result:=','; // arabic decimal separator, persian thousand separator
#$AC: Result:=''''; // arabic thousand separator
end;
#$E2:
case Buf[1] of
#$80:
case Buf[2] of
#$82, // long space
#$83, // long space
#$89, // thin space
#$AF: // narrow non breakable space
Result := ' ';
#$94: Result := '-'; // persian decimal mark
end;
#$8E: if Buf[2]=#$96 then Result := ''''; // codepoint 9110 decimal separator
end;
end;
end;
end;
procedure GetFormatSettingsUTF8(LCID: Integer; var aFormatSettings: TFormatSettings);