Re: Using MBCS in a UNICODE defined project

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



How are you "reading" it?

Bob


"David Wilkinson" <no-reply@xxxxxxxxxxxx> wrote in message
news:%23uTi5EglHHA.4032@xxxxxxxxxxxxxxxxxxxxxxx
hamishd wrote:
Hi, my project has the UNICODE and _UNICODE macros defined. I want to
display a lot of chinese text, and this is working well for me.

However, within the code, I make a call to a function:
TestFunction(char * input);

I need to supply it with MBCS format. So I use a T2A()....
TestFunction(T2A(input)); and all is good (assuming the string is
english alphabet chars).

However.. that "input" string is read from a text file. If the input
string is something like this..
"abcdefgXXXhigjklmop" - where "XXX" denotes some chinese MBCS chars

If i read that string my project reads it as unicode and gets it
wrong. How do i "tell" my application to read it as MBCS (it's always
MBCS)?

I hope this makes sense.. it's a bit confusing to me. The reading
worked correctly before i changed my app to UNICODE. now if there's
chinese chars in the file, it doesn't work.

hamishd :

WideCharToMultiByte().

--
David Wilkinson
Visual C++ MVP


.



Relevant Pages

  • Re: Using MBCS in a UNICODE defined project
    ... display a lot of chinese text, and this is working well for me. ... I need to supply it with MBCS format. ... and all is good (assuming the string is ... If i read that string my project reads it as unicode and gets it ...
    (microsoft.public.vc.mfc)
  • Using MBCS in a UNICODE defined project
    ... my project has the UNICODE and _UNICODE macros defined. ... display a lot of chinese text, and this is working well for me. ... I need to supply it with MBCS format. ... and all is good (assuming the string is ...
    (microsoft.public.vc.mfc)
  • Re: Learning the fretboard..
    ... Sight reading at a higher level entails recognition of musical ... is your default handling of two whole steps along a string, ... -Start with a major triad, in root position, with the root on the ... There is only one way to play this triad. ...
    (rec.music.classical.guitar)
  • =?Big5?Q?Re=3A_Bamboo_=B5=A9_is_called_copper_coin=2E_Why=3F?=
    ... An early European taking a Chinese word from ... The 'rope' was squeezed to a 'string'. ... evidence that supports them in realtion to the money-suited playing ... Chinese playing cards. ...
    (rec.games.mahjong)
  • Re: Program slow. Garbage Collection
    ... the larger string I only had to build one string and call ToLoweron ... The three different possible approaches discussed so far -- "read the whole file", "read a line at a time as separate strings", "read a line at a time into a pre-allocated buffer" -- all have the bulk of their cost in the same thing: ... Reading a line at a time into separate strings does wind up creating a large number of individual strings. ... Also, these objects may survive long enough to wind up in the older generations of the heap; on the one hand, that alleviates the cost those objects cause for GC operations, but on the other hand you know for sure those objects are still going to get destroyed soon, so it'd be better for them to not wind up in the older generation where they may remain and cause increased memory pressure for a longer time. ...
    (microsoft.public.dotnet.languages.csharp)