Thread View: borland.public.cppbuilder.nativeapi
3 messages
3 total messages
Started by Asger Jørgensen
Sat, 29 Sep 2007 12:46
UTF-8 conversion is it safe to asume ?
Author: Asger Jørgensen
Date: Sat, 29 Sep 2007 12:46
Date: Sat, 29 Sep 2007 12:46
16 lines
1347 bytes
1347 bytes
Hi there I use MultiByteToWideChar on my UTF-8 datastreams to get the size of the buffer needed for converting, that works just fine. Sometimes the function returns the exact same size as the original stream. Can I, in theses cases, assume that there is no characters in the stream that needs to be converted ?? And the go on processing the contents without converting it ? Thanks in advance Kind regards Asger
Re: UTF-8 conversion is it safe to asume ?
Author: Eelke
Date: Mon, 01 Oct 2007 12:06
Date: Mon, 01 Oct 2007 12:06
23 lines
1710 bytes
1710 bytes
Asger Jørgensen schreef: > Hi there > > I use MultiByteToWideChar on my UTF-8 datastreams to > get the size of the buffer needed for converting, > that works just fine. > > Sometimes the function returns the exact same size > as the original stream. > Can I, in theses cases, assume that there is no > characters in the stream that needs to be converted ?? > And the go on processing the contents without > converting it ? > > Thanks in advance > Kind regards > Asger No, afaik there is no garantee that a 2 byte mbchar is the same as the widechar second the mbstring could also contain 3 byte and 1 byte mbchars which would definitly not be the same. Eelke
Re: UTF-8 conversion is it safe to asume ?
Author: Asger Jørgensen
Date: Mon, 01 Oct 2007 15:34
Date: Mon, 01 Oct 2007 15:34
20 lines
1593 bytes
1593 bytes
Hi Eelke In article <4700e2ab$1@newsgroups.borland.com>, e.klein@remove.mplussoftware.nl says... > Asger Jørgensen schreef: > > Hi there > > > > I use MultiByteToWideChar on my UTF-8 datastreams to > > get the size of the buffer needed for converting, > > that works just fine. > > No, afaik there is no garantee that a 2 byte mbchar is the same as the > widechar second the mbstring could also contain 3 byte and 1 byte > mbchars which would definitly not be the same. You are absolutely right. Thanks! Kind regards Asger
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