I want to encode a .html file (wxString) into hex. I tried to achieve this by
data = wxString((const char*)html_stuff, wxCSConv(wxFONTENCODING_UTF8), sizeof (html_stuff));
Thank you!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The code you posted is converting from UTF8 to unicode
http://docs.wxwidgets.org/2.9.2/classwx_string.html#86a2ec232912c97ed44ba34651d98123
UTF8 uses 1 to 3 bytes to encode each character – it is used to send documents in HTML so browsers can display them. Unicode uses 2 bytes to encode every character – it is used by wxString.
My guess is that what you want to do is convert a unicode wxString to UTF8. There are lots of different ways to do that. The ‘best’ way depends on several things. The simplest would be to use wxString::mb_str() http://docs.wxwidgets.org/2.8.9/wx_wxstring.html#wxstringmbstr
I recomend that you learn something about character encoding. Here is a link to my take on it.