mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 10:59:06 +02:00
Tunes the ansi conversion to really target ansi, not utf-8 as previously
git-svn-id: trunk@32978 -
This commit is contained in:
parent
5b05dc0fdd
commit
4d936c5608
@ -37,8 +37,10 @@ begin
|
|||||||
SetLength(widestr, len);
|
SetLength(widestr, len);
|
||||||
System.Move(source^, widestr[1], len);
|
System.Move(source^, widestr[1], len);
|
||||||
|
|
||||||
// Now convert it, using UTF-8 -> UTF-16
|
// Now convert it, using UTF-16 -> UTF-8
|
||||||
dest := UTF16ToUTF8(widestr);
|
dest := UTF16ToUTF8(widestr);
|
||||||
|
// And correct to the real Ansi encoding
|
||||||
|
dest := ConvertEncoding(dest, EncodingUTF8, GetDefaultTextEncoding());
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure Ansi2WideMove(source:pchar;var dest:widestring;len:SizeInt);
|
procedure Ansi2WideMove(source:pchar;var dest:widestring;len:SizeInt);
|
||||||
@ -50,7 +52,9 @@ begin
|
|||||||
SetLength(ansistr, len);
|
SetLength(ansistr, len);
|
||||||
System.Move(source^, ansistr[1], len);
|
System.Move(source^, ansistr[1], len);
|
||||||
|
|
||||||
// Now convert it, using UTF-16 -> UTF-8
|
// Convert to UTF-8
|
||||||
|
ansistr := ConvertEncoding(ansistr, GetDefaultTextEncoding(), EncodingUTF8);
|
||||||
|
// Now convert it, using UTF-8 -> UTF-16
|
||||||
dest := UTF8ToUTF16(ansistr);
|
dest := UTF8ToUTF16(ansistr);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -286,8 +290,10 @@ begin
|
|||||||
SetLength(widestr, len);
|
SetLength(widestr, len);
|
||||||
System.Move(source^, widestr[1], len*2);
|
System.Move(source^, widestr[1], len*2);
|
||||||
|
|
||||||
// Now convert it, using UTF-8 -> UTF-16
|
// Now convert it, using UTF-16 -> UTF-8
|
||||||
dest := UTF16ToUTF8(widestr);
|
dest := UTF16ToUTF8(widestr);
|
||||||
|
// And correct to the real Ansi encoding
|
||||||
|
dest := ConvertEncoding(dest, EncodingUTF8, GetDefaultTextEncoding());
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure Ansi2UnicodeMove(source:pchar;var dest:UnicodeString;len:SizeInt);
|
procedure Ansi2UnicodeMove(source:pchar;var dest:UnicodeString;len:SizeInt);
|
||||||
@ -299,7 +305,9 @@ begin
|
|||||||
SetLength(ansistr, len);
|
SetLength(ansistr, len);
|
||||||
System.Move(source^, ansistr[1], len);
|
System.Move(source^, ansistr[1], len);
|
||||||
|
|
||||||
// Now convert it, using UTF-16 -> UTF-8
|
// Convert to UTF-8
|
||||||
|
ansistr := ConvertEncoding(ansistr, GetDefaultTextEncoding(), EncodingUTF8);
|
||||||
|
// Now convert it, using UTF-8 -> UTF-16
|
||||||
dest := UTF8ToUTF16(ansistr);
|
dest := UTF8ToUTF16(ansistr);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user