|
-
May 8th, 2010, 04:05 PM
#6
Re: How to convert string with double high/wide characters to normal string [VC++6]
 Originally Posted by Shaitan00
Won't using WideCharToMultiByte still change the constants (like the overall string size, location of the decimal, etc...)?
Also, not all characters are represented in Wide format, some are still normal like the "item" part. In reality it is only the price I need to worry about.
Take that part of the string that isn't single-byte, store it in a temporary, convert it, and just build the new string from it.
I really don't quite understand your concern about decimal positions, string sizes, etc. Fix that later -- the goal right now is to clearly and safely convert a wide set of characters to non-wide characters, and the only way to do that safely is to use API's to do it. You don't do it by coding if() statements that reflect what you believe is the right translation. If your code is reviewed by a someone else, coding stuff like that would get rejected immediately if the platform you're working with has API's to do this work. Again, code pages makes it virtually impossible for you to write correct if() statements for this type of work.
Customer was made aware, didn't really care ... and we can't really stop supporting them because of it... One of those customer-is-always-right situations.
Then that is either not communicating clearly that single byte and wide characters are not the same thing, or the customer risking a hack that could break other parts of the program. Then when the customer starts to use other multi-byte characters in the app (they now want Chinese to be supported for some reason), then what? Sometimes you have to be forceful, if not, you could be starting a slippery slope -- I've seen it all before.
Regards,
Paul McKenzie
Last edited by Paul McKenzie; May 8th, 2010 at 04:11 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|