Article View: borland.public.cppbuilder.nativeapi
Article #1376Re: UTF-8 to curent locale
From: Thomas Maeder [TeamB]
Date: Mon, 10 Sep 2007 15:59
Date: Mon, 10 Sep 2007 15:59
32 lines
2411 bytes
2411 bytes
Asger Jorgensen <Junk@Asger-P.dk> writes: > In article <46e54543@newsgroups.borland.com>, kiklop@fibertel.com.ar says... >> >> There is no need for API. VCL offers function Utf8ToAnsi in system unit >> (that is in BDS 2006). If you have older version of BCB than you can use >> two api's to accomplish this conversion: > > I only have BCB5 pro Have you checked whether you have Utf8ToAnsi()? >> MultiByteToWideChar - this one converts multibyte string to unicode >> WideCharToMultiByte - this one can convert unicode to ansi >> >> So with MultiByteToWideChar convert utf-8 to unicode and than with >> WideCharToMultiByte convert that unicode to ansi string. > > Is there realy no function that translate UTF-8 to good old ascii > in one pass ?? I would very much like it to be fast. You don't need a conversion from UTF-8 to ASCII; all ASCII characters have the same code in UTF-8 and ASCII. In your original post, you wrote "to an asci string in the curent local codepage", which is a contradiction, since code pages have characters with codes >= 128, which ASCII doesn't. If you need support for those non-ASCII characters, Utf8ToAnsi() comes in.
Technical Details
Message-ID:
<m23axmtstn.fsf@glue.ch>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<MPG.214e8e1e8b10f7259897e4@newsgroups.borland.com> <46e54543@newsgroups.borland.com> <MPG.214f7a08942d25809897e5@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,1467a6fdb7f4c516
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: UTF-8 to curent locale
References: <MPG.214e8e1e8b10f7259897e4@newsgroups.borland.com> <46e54543@newsgroups.borland.com>
<MPG.214f7a08942d25809897e5@newsgroups.borland.com>
From: maeder@glue.ch (Thomas Maeder [TeamB])
Organization: TeamB
X-Face: ":yn4zt^A_dn>6~{YJmu^B\'4w)e:apPM\VC=Dvf&*tASxX9|BYczkFd$xr.$vNSZ[3Uobr p]c4\+\l){!WQI.$]veP({HLd;CDYH?iN
Date: Mon, 10 Sep 2007 17:59:16 +0200
Message-ID: <m23axmtstn.fsf@glue.ch>
User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)
Cancel-Lock: sha1:umcn5R6lcc1Oo+3HC8jOGtpFkZk=
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
NNTP-Posting-Host: 80.219.160.32
X-Trace: newsgroups.borland.com 1189439956 80.219.160.32 (10 Sep 2007 08:59:16 -0700)
Lines: 32
X-Authenticated-User: tmaeder
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail