🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internationalization
Article #310

Re: UTF8Decode Problem

#310
From: Andrue Cope [TeamB]
Date: Tue, 24 Aug 2004 08:01
37 lines
2369 bytes
g wrote:

>  The problem that I experienced is that when use TStrings to read a
> line and display on the ListBox1, some of the characters are encoded
> correctly, but some characters display in question mark (?)

The VCL does not use Unicode strings. That means that when it displays
characters they have to all belong to the same codepage. To put it
another way - there is only ever 256 characters that VCL components can
display. Which 256 characters depends on the font being used and the
codepage settings.

When you convert a WideString into an AnsiString the conversion will
attempt to find a character in the current codepage for every character
in the WideString. If you are getting characters that can come from any
language then there is scope for at least some of them to be
unrepresentable in the current codepage and you get a '?' in their
place.

To use a specific example:If I try to display a string with Cyrillic
(Russian) characters using the VCL I will get '?'s. This is because I
live in the UK and my machine is configured for Western European
characters.

The only solution to your particular problem is to display the
WideStrings themselves. We use the following library:

  http://www.shareup.com/ElPack-download-989.html

In practice you'll probably only have to convert a few components to
Unicode. Most of them can survive as 8-bit simply by translating the
original strings.

-- 
Andrue Cope [TeamB]
[Bicester, Uk]
http://info.borland.com/newsgroups/guide.html
Technical Details
Message-ID: <412af5c2@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <412ac101$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10297d,f2c293d7982a2280
X-Google-Attributes: gid10297d,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Andrue Cope [TeamB]" <no.spam@spammy.com>
Subject: Re: UTF8Decode Problem
Newsgroups: borland.public.cppbuilder.internationalization
References: <412ac101$1@newsgroups.borland.com>
User-Agent: XanaNews/1.16.4.2
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
NNTP-Posting-Host: 217.207.223.34
Message-ID: <412af5c2@newsgroups.borland.com>
Date: 24 Aug 2004 01:01:06 -0700
X-Trace: newsgroups.borland.com 1093334466 217.207.223.34 (24 Aug 2004 01:01:06 -0700)
Lines: 37
X-Authenticated-User: acope
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail