Re: Multilanguage support for CEdit

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"Tom Serface" <tom.nospam@xxxxxxxxxxxxx> wrote

The biggest thing that stumbles me doing conversions is how CString converts the strings back and forth. So if you have something like:

CString cs = "String";

It will still compile OK, but cs won't be Unicode just because you recompile

When you write the following, pBuf is a unicode string. A memory dump shows it.

CString sc("abcd € fg");
wchar_t* pBuf = cs.GetBuffer();

(at least in my experience). I typically just do a search on all CStrings and fix them up with:

CString cs = _T("String");

But the cleanest way is to keep any visible text out of the sourcecode and do
cs.LoadString(IDS_XYZ);

BTW, doing a unicode conversion is a good chance to clean up the house.

Hans


.



Relevant Pages

  • Re: L macro
    ... ..cpp file, it could compile. ... "Alexander Nickolov" wrote: ... Coding everything in UNICODE wide characters ... So, if you want to use Unicode UTF-16 strings in your app, you should put ...
    (microsoft.public.vc.language)
  • Re: How to check variables for uniqueness ?
    ... characters is the sequence SS. ... is simply capitalizing strings. ... The fact that case mapping in English /is/ simple is neither here not ... That is a fair criticism of the Unicode position. ...
    (comp.lang.java.programmer)
  • Re: Dangerous behavior of CString
    ... If I'm reading a data file or serial port or something, if the raw data are multibyte but the compilation is Unicode or vice-versa, then sometimes the converting constructors in CString are convenient. ... I did not actually write code like this; in fact I was pretty careful always to use the _T macro with any literal strings. ... But it does the conversion using the current 8-bit code page, which is not what I want. ...
    (microsoft.public.vc.mfc)
  • Re: Help please
    ... i would like to provide "CSimString" class code because the settings ... I agree with Tom that first step is project clean and rebuild all. ... with a Unicode string, ... Consider that VS2005 strings are Unicode by default, ...
    (microsoft.public.vc.mfc)
  • Re: passing a string to a dll
    ... bool DLLRect::PullWhisker ... The interface for the DLL exported function could be like so: ... based on _UNICODE flag, e.g. ... I think that in these days those ANSI strings are something from the ...
    (microsoft.public.vc.mfc)