Re: Why use the unicode version of the api?



What you're doing will work well as long as you're only operating in one
locale Gustavo, e.g. Korean.

Unicode only becomes important if your code, or data, are spanning multiple
locales. For instance, if your registry happened to contain both Korean and
Japanese data then the ansi API version will not cope with both types of
data.

There may also be a slight performance issue. For instance, the registry
holds its data internally in Unicode, and VB uses Unicode strings. Hence,
using the 'W' API forms instead of the 'A' forms would bypass any
translation to an intermediate "ANSI" form. Note that this isn't true of all
'W' APIs though. It depends on where the data originate since Windows
doesn't use 100% Unicode.

Tony Proctor

"Gustavo Echevarria" <g.echevarria@#REMOVETHIS#lantek.es> wrote in message
news:##GJvRz#FHA.208@xxxxxxxxxxxxxxxxxxxxxxx
> hello again
> i've use the ansi version in a dbcs korean system with a string in korean
> and sames to functions good. Can someone know what are the problems with
> this api 32 unicode funcion? why is necesary to use them in an aplication
> programming?
> Thanks in advanced
> Gustavo Echevarria
>
> "Thorsten Albers" <albersRE@xxxxxxxxxxxxxxxxxxx> escribió en el mensaje
> news:01c5eba4$e2b1e380$b38ee684@xxxxxxxxxxx
> > Gustavo Echevarria <g.echevarria@#REMOVETHIS#lantek.es> schrieb im
Beitrag
> > <#UMiMt56FHA.2036@xxxxxxxxxxxxxxxxxxxx>...
> >> i have a question regarding the two different versions of the win32
apis
> > of
> >> some functions. For example RegQueryValueExW and RegQueryValueExA. Can
i
> > use
> >> any of them in a chinesse operation system?. What problems can i have
in
> >> those dbcs systems?
> >
> > With the "W" version you will get the Unicode text. With the "A" version
> > you will get the Unicode text converted to ANSI text. But: ANSI is a
> > character encoding supporting only 255 characters (1 byte per
character),
> > Unicode uses 2 bytes per character thus supporting at least 65536
> > characters (with the so-called surrogates it is more then 65536). For
some
> > Unicode codepoint ranges the 256 characters are sufficient, but for most
> > of
> > them they are not since most writing systems are using more then 256
> > characters.
> > On a japanese and chinese version of windows the ANSI functions do
support
> > DBCS ANSI strings with a mixture of one or two bytes per character
> > (handled
> > by the use of so-called lead bytes). But AFAIK this isn't valid for
other
> > writing systems that are using more then 256 characters, i.e. DBCS with
> > "A"
> > functions is restricted to japanese and chinese. So, if not used
> > explicitely for japanese or chinese writing system strings, using the
"A"
> > version would result in information loss.
> > And DCBS ANSI strings are not easy to handle, Unicode strings clearly
are
> > the better choice. DCBS is the past, Unicode is the future...
> > If you want to use DCBS in your application, of course you should use
the
> > "A" function versions, or, IMHO better, you should use the "W" versions
> > and
> > map the Unicode strings with MultiByteToWideChar()/WideCharToMultiByte()
> > from or to DBCS ANSI strings.
> >
> > --
> > ----------------------------------------------------------------------
> > THORSTEN ALBERS Universität Freiburg
> > albers@
> > uni-freiburg.de
> > ----------------------------------------------------------------------
> >
>
>
>


.



Relevant Pages

  • Re: Skipws
    ... I have tested skipws works for both ANSI and UNICODE version strings (i.e. ... char and wchar_t). ...
    (microsoft.public.vc.language)
  • Re: Serial Port : error in opening
    ... >> must be UNICODE, not ANSI. ... If you're reading existing ANSI files, ... >> you can choose to keep the strings as ANSI internally. ... >> bom windows ce ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Call C DLL from VB.net-problem..array gains 4 bytes!
    ... No, Unicode strings don't, by definition, have a header with the size. ... you're writing code in C++, for example, the only difference between an ANSI ... which take an array of bytes. ... > Remember the DLL declaration... ...
    (microsoft.public.windowsce.app.development)
  • Re: Convert CString to LONG.
    ... people used ASCII to store strings. ... Unicode was considered the standard to represent ... Typically, ANSI version ended with A, ... It is easy to code in Unicode-aware way if you use CString and Microsoft ...
    (microsoft.public.vc.mfc)
  • Re: A (mild-mannered) defense of RosAsm Rocks !!!
    ... All functions that have a Unicode ... and ANSI implementation are Unicode first, ... this API is not available in Win9x without the ... Oh by the way the Coward is the asshole that wrote the peice of garbage ...
    (alt.lang.asm)