🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internationalization
6 messages
6 total messages Started by Emmanuel Mon, 08 Jan 2007 19:06
What is the different between AnsiString and UTF8String?
#14
Author: Emmanuel
Date: Mon, 08 Jan 2007 19:06
1 lines
954 bytes
What is the different between AnsiString and UTF8String? 
Re: What is the different between AnsiString and UTF8String?
#15
Author: Igor Siticov
Date: Wed, 10 Jan 2007 08:45
12 lines
1315 bytes
UTF8String is AnsiString but all characters with code > 128 are encoded. So 
if you just display it somewhere you would see a garbage chars for these 
characters.

-- 
Best regards.
TsiLang Components Suite - Best Globalization Tool 2004
http://www.tsilang.com
"Emmanuel" <emmanuel@erphk.com> wrote in message 
news:45a29580@newsgroups.borland.com...
> What is the different between AnsiString and UTF8String?
> 
Re: What is the different between AnsiString and UTF8String?
#17
Author: Jaakko Salmenius
Date: Thu, 11 Jan 2007 09:26
23 lines
2046 bytes
What do you mean encoded? As far as I see they are both encoded.

UTF8String contains UTF-8 encoded Unicode string. Each character is 1, 2, 3, 
4 bytes long.

AnsiString contains code page encoded string. Depending on the code page 
each character is either 1, or 1 or 2 characters long. Asian code pages use 
multi byte encoding code pages where each character is either 1 byte or 2 
bytes. All Windows code pages has identical first 128 characters. If the 
most significant byte of an AnsiString is 1 then the byte is extended byte 
that is either single character (such as � or � in code page 1252) or needs 
the following byte to describe the character.

Also in AnsiString you will see garbage if the system code page does not 
match the code page used in the string. For example using Japanese (code 
page 932) string on English Windows.

Both UTF8String and AnsiString must be read byte by byte to get the real 
meaning.

Best regards,
Jaakko Salmenius
www.sisulizer.com 
Re: What is the different between AnsiString and UTF8String?
#18
Author: Igor Siticov
Date: Mon, 15 Jan 2007 17:25
22 lines
1890 bytes
Hi,

> What do you mean encoded? As far as I see they are both encoded.
>

IMHO!
Utf8String is encoded but AnsiString is "as is" string. AnsiString is single 
byte string and will be displayed properly only while using proper code 
page. MBCS strings are multi-byte and they apply to all you wrote below. But 
AnsiString is "plain" single-byte string and this is why they will look 
differently under different code pages because there is no codepage info in 
single-byte data just char itself (for some Asian codepages there will be 
needed 2 bytes to decode one single char but there still no any code page 
info in AnsiString). I think you mixed in your post byte and bit. Most 
significant BIT describes the character "range".



-- 
Best regards.
TsiLang Components Suite - Best Globalization Tool 2004
http://www.tsilang.com 
Re: What is the different between AnsiString and UTF8String?
#19
Author: Jaakko Salmenius
Date: Tue, 16 Jan 2007 03:30
14 lines
1694 bytes
Multi byte strings are also AnsiStrings. Most major Asian countries 
including Japan, China, Taiwan and Korean use multi byte encoding. Shift 
JIS/932 is a multi byte encoding. Delphi's AnsiString can contains these 
string just like English, Finnish and Russian.

My point is that whenever there is an AnsiString in Delphi you need to know 
what is the code page that the string uses. Otherwise you might end up 
interpreting the string incorrectly.

You were right about byte and bit. I ment bit but wrote byte.

Best regards,
Jaakko Salmenius
www.sisulizer.com 
Re: What is the different between AnsiString and UTF8String?
#20
Author: Igor Siticov
Date: Tue, 16 Jan 2007 09:53
18 lines
1555 bytes
Hi,

> My point is that whenever there is an AnsiString in Delphi you need to 
> know what is the code page that the string uses. Otherwise you might end 
> up interpreting the string incorrectly.

Yes, this is absolutely right.

>
> You were right about byte and bit. I ment bit but wrote byte.
>

OK, no problem, it was just confusing a bit. :)

-- 
Best regards.
TsiLang Components Suite - Best Globalization Tool 2004
http://www.tsilang.com 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads