🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #1373

Re: UTF-8 to curent locale

#1373
From: Darko Miletic
Date: Mon, 10 Sep 2007 13:23
20 lines
1839 bytes
Asger Jorgensen wrote:
> Hi there
> 
> Is there an API function that can translate a UTF-8 string
> to an asci string in the curent local codepage ?
> 
> This situation is that I recieve some files from 
> companies here in my country, and because of an international
> standard in these files, they are in the UTF-8 format.
> 

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:

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.
Technical Details
Message-ID: <46e54543@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <MPG.214e8e1e8b10f7259897e4@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
Date: Mon, 10 Sep 2007 10:23:12 -0300
From: Darko Miletic <kiklop@fibertel.com.ar>
Reply-To: Darko Miletic <kiklop@fibertel.com.ar>
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: UTF-8 to curent locale
References: <MPG.214e8e1e8b10f7259897e4@newsgroups.borland.com>
In-Reply-To: <MPG.214e8e1e8b10f7259897e4@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
X-Antivirus: avast! (VPS 000774-0, 10/09/2007), Outbound message
X-Antivirus-Status: Clean
NNTP-Posting-Host: 200.49.157.163
Message-ID: <46e54543@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1189430595 200.49.157.163 (10 Sep 2007 06:23:15 -0700)
Lines: 22
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail