|
-
May 6th, 2014, 04:21 AM
#1
reading and writing xml with Chinese C/C++
Currently I'm working on a application which reads the input from the server and write to a file.
Message stored in server : idle_message="维杰PC时钟" key_prompt="在按键"
1. Server is sending a xml reply with encode type as "UTF-8". In my code I'm store in a char array.
[ char * ch = "idle_message="缁存澃PC鏃堕挓" key_prompt="鍦ㄦ寜閿" msg came from server and copied from vs2005 watch point]
2. After this I'm writing the same to a file in my desk using the API WriteFile. When i open the file in Editplus below is the content.
idle_message="维杰PC时钟" key_prompt="在按键"
3. Again I'm trying to read the file and storing into the char array. Below is the content viewed by the watchpoint in VS2005.
idle_message="缁存澃PC鏃堕挓" key_prompt="鍦ㄦ寜閿?
I'm trying to find the starting and ending chinese char and I'm converting that char to wchar_t using the API mcstowcs() for display, its coming as completely junk chars.
I can able to every place the chinese char are different.
Now kindly help how to overcome this problem.
Message from server is same which is written into the file. When I view in VS2005, it looks different and after the mcstowcs(), I'm not getting the correct message which I want.
Thanks
Vijay
Tags for this Thread
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
|