From: Mihai N. on 11 Sep 2009 03:31 > Its not junk. Its exactly as you say. If it is as I say, then it is junk. You should have Unicode values in a Unicode CString, not 1251 So you should have U+041C U+0456 Mihai -- Mihai Nita [Microsoft MVP, Visual C++] http://www.mihai-nita.net ------------------------------------------ Replace _year_ with _ to get the real email
From: Mihai N. on 11 Sep 2009 03:35 > You don't need a char buff; you can use CStringA. True. But to be fair, I normally do something else: - read the stuff in a BYTE array (I don't know it is text yet) - look for BOM to see if it is UTF-16BE or UTF-16LE - if yes, copy to a WCHAR array (and byte swap if needed) (and, sure, the WCHAR array might be a GetBuffer from a CStringW) - end if job - if there is no BOM, check if I have HTTP header info - if there is nothing in the http header, look for META - use that info to MultiByteToWideChar -- Mihai Nita [Microsoft MVP, Visual C++] http://www.mihai-nita.net ------------------------------------------ Replace _year_ with _ to get the real email
From: Giovanni Dicanio on 11 Sep 2009 04:15 Mihai N. ha scritto: > But to be fair, I normally do something else: > [...] I wonder if the ATL Server library has something to do it out-of-the-box. http://www.codeplex.com/AtlServer I read in the documentation: <quote> HTML generation on server side and reading on client sides in atlhtml.h </quote> Giovanni
From: Joseph M. Newcomer on 11 Sep 2009 07:57 I tend to use CByteArray for the input buffer, but yes, I pretty much follow the same style. I don't do much with HTTP, so I tend to leave UTF-16BE as "unsupported", which I admit is a bit sloppy. I can get away with it because everything I work on is actually x86 local, but supporting UTF-16BE would be essential when you really don't know the source machine. joe On Fri, 11 Sep 2009 00:35:26 -0700, "Mihai N." <nmihai_year_2000(a)yahoo.com> wrote: >> You don't need a char buff; you can use CStringA. > >True. >But to be fair, I normally do something else: > - read the stuff in a BYTE array (I don't know it is text yet) > - look for BOM to see if it is UTF-16BE or UTF-16LE > - if yes, copy to a WCHAR array (and byte swap if needed) > (and, sure, the WCHAR array might be a GetBuffer from a CStringW) > - end if job > - if there is no BOM, check if I have HTTP header info > - if there is nothing in the http header, look for META > - use that info to MultiByteToWideChar Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
First
|
Prev
|
Pages: 1 2 3 4 5 6 Prev: 063770 M3i Zero , Ezflash Dsi , R4i Dsi 68210 Next: SetTimer not calling OnTimer? |