Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Unicode conversion (attention all devs)

<< < (7/23) > >>

tiwag:

--- Quote from: byo on August 05, 2005, 06:41:58 pm ---One question - if wxStrring is used as a param inside printf-like function should it be converted using c_str() or mb_str() ?

Example:

--- Code: ---tmpkey.Printf(_T("%s/editor/keywords/%d"), key.c_str(), i);
--- End code ---

--- End quote ---

hi byo - how did you proceed with this ?

takeshimiya:
Do not use wxChar when is not a text character, because a wxChar in unicode is an int of 16 bits (not 8 bits):

Example for text:
wxChar im_a_character = _T('f');

Example for not text (not character):
char im_a_byte = 254;
but perhaps better would be to use:
byte im_a_byte = 254;
so it's clear that it's a byte and not a character.

tiwag:
what to do here ?

--- Code: ---            // indent code accordingly
            wxString code = it->second;
            code.Replace("\n", '\n' + lineIndent);

--- End code ---

from the docs:

--- Quote ---wxString::Replace
size_t Replace(const char* szOld, const char* szNew, bool replaceAll = true)

Replace first (or all) occurrences of substring with another one.

replaceAll: global replace (default), or only the first occurrence.

Returns the number of replacements made.
--- End quote ---


wxString::Replace()  seems to be not fit for unicode ? or what ?

rickg22:
Stan: Take the sources from the CVS snapshot. There were 2 or 3 bugs fixed after RC1-1.

Tiwag: If the input is a const char*, use "normal strings". If the input is a wxChar or wxString, use the _T("macros").

So in this case, just use normal strings.

darklordsatan:

--- Quote from: rickg22 on August 05, 2005, 10:56:39 pm ---Stan: Take the sources from the CVS snapshot. There were 2 or 3 bugs fixed after RC1-1.

--- End quote ---

So, the branch is VERSION_1 not HEAD, right?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version