Answered by:
how to create a String object from UTF8 data and get UTF8 char* from String Object

Question
-
Hi,
i have a UTF8 string char *utf8bytes;
i need a String object from this -
i could construct one using by using MultiByteToWideChar function to get wchar* and then construct a String from that
but is there an easy way to do it ? C# has "Encoding" namespace which provides some easy utility functions is that available for C++ ?
i have to mention, the Metro Platform String class is very limited - the NSString in iOS is more powerful and i expected the same on Metro apps as well .
Sad that developer needs to spend so much time on working with strings itself !! very bad
Raj
Tuesday, August 14, 2012 12:50 PM
Answers
-
Platform::String is not designed to be a full featured string class. It's designed to manage the string buffer lifetime and pass it across the WinRT ABI boundary. STL strings are the the string library of choice for Windows Store apps. They can be converted easily to Platform::String and vice-versa. MBTWC is compatible with Windows Store apps, so you can certainly use it.
- Proposed as answer by Jesse Jiang Wednesday, August 15, 2012 5:51 AM
- Marked as answer by Jesse Jiang Friday, August 24, 2012 7:06 AM
Tuesday, August 14, 2012 7:53 PMModerator -
Agreed with Steve. In addition, there are some threads which are talking about the char* to string
http://social.msdn.microsoft.com/Forums/en-US/winappswithnativecode/thread/48794f27-0db7-4335-bdfe-dca664ca28a9And string to char*
http://social.msdn.microsoft.com/Forums/en-US/winappswithnativecode/thread/c39b3060-0c2d-40b7-aa8c-035f1fad441cBest regards,
JesseJesse Jiang [MSFT]
MSDN Community Support | Feedback to us
- Marked as answer by Jesse Jiang Friday, August 24, 2012 7:06 AM
Monday, August 20, 2012 7:50 AM
All replies
-
Platform::String is not designed to be a full featured string class. It's designed to manage the string buffer lifetime and pass it across the WinRT ABI boundary. STL strings are the the string library of choice for Windows Store apps. They can be converted easily to Platform::String and vice-versa. MBTWC is compatible with Windows Store apps, so you can certainly use it.
- Proposed as answer by Jesse Jiang Wednesday, August 15, 2012 5:51 AM
- Marked as answer by Jesse Jiang Friday, August 24, 2012 7:06 AM
Tuesday, August 14, 2012 7:53 PMModerator -
Agreed with Steve. In addition, there are some threads which are talking about the char* to string
http://social.msdn.microsoft.com/Forums/en-US/winappswithnativecode/thread/48794f27-0db7-4335-bdfe-dca664ca28a9And string to char*
http://social.msdn.microsoft.com/Forums/en-US/winappswithnativecode/thread/c39b3060-0c2d-40b7-aa8c-035f1fad441cBest regards,
JesseJesse Jiang [MSFT]
MSDN Community Support | Feedback to us
- Marked as answer by Jesse Jiang Friday, August 24, 2012 7:06 AM
Monday, August 20, 2012 7:50 AM