LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   the problem in wide character string receiving (https://www.linuxquestions.org/questions/linux-software-2/the-problem-in-wide-character-string-receiving-738226/)

naveenisback 07-07-2009 01:41 AM

the problem in wide character string receiving
 
Hi frenz,


Im doing client server program. in which client is running in a linux machine and server running in windows machine. the data type of send_buffer and receive_buffer is wchar_t. I receive an xml message from windows(server) like this...

<^@?^@x^@m^@l^@ ^@v^@e^@r^@s^@i^@o^@n^@=^@"^@1^@.^@0^@"^@?^@>^@^M^@
^@<^@S^@y^@s^@t^@e^@m^@i^@n^@f^@o^@>^@^M^@
^@ ^@<^@C^@P^@U^@I^@n^@f^@o^@>^@^M^@
^@ ^@ ^@^M^@
^@ ^@ ^@<^@P^@r^@o^@c^@e^@s^@s^@o^@r^@_^@N^@a^@m^@e^@>^@I^@n^@t^@e^@l^@(^@R^@)^@ ^@P^@e^@n^@t^@i^@u^@m^@(^@R^@)^@
^@D^@u^@a^@l^@ ^@ ^@C^@P^@U^@ ^@ ^@E^@2^@1^@8^@0^@ ^@ ^@@^@ ^@2^@.^@0^@0^@G^@H^@z^@<^@/^@P^@r^@o^@c^@e^@s^@s^@o^@r^@_^@N^@a^
@m^@e^@>^@^M^@
^@ ^@ ^@<^@N^@o^@_^@o^@f^@_^@P^@r^@o^@c^@e^@s^@s^@o^@r^@s^@>^@2^@<^@/^@N^@o^@_^@o^@f^@_^@P^@r^@o^@c^@e^@s^@s^@o^@r
^@s^@>^@^M^@
^@ ^@ ^@<^@P^@r^@o^@c^@e^@s^@s^@o^@r^@_^@C^@u^@r^@r^@e^@n^@t^@S^@p^@e^@e^@d^@>^@1^@1^@9^@9^@ ^@M^@H^@z^@<^@/^@P^@r
^@o^@c^@e^@s^@s^@o^@r^@_^@C^@u^@r^@r^@e^@n^@t^@S^@p^@e^@e^@d^@>^@^M^@
^@ ^@ ^@<^@M^@e^@m^@o^@r^@y^@_^@U^@s^@e^@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d^@i^@t^@i^@o^@n^@<^@/^@O^@S^@>^@^M^@
^@ ^@ ^@<^@S^@e^@r^@v^@i^@c^@e^@P^@a^@c^@k^@>^@S^@e^@r^@v^@i^@c^@e^@ ^@P^@a^@c^@k^@ ^@2^@<^@/^@S^@e^@r^@v^@i^@c^@e
^@P^@a^@c^@k^@>^@^M^@
^@ ^@ ^@<^@B^@u^@i^@l^@d^@N^@o^@>^@3^@7^@9^@0^@<^@/^@B^@u^@i^@l^@d^@N^@o^@>^@^M^@
@
@
@
@

why it is happening like this.. after receiving I have to validate xml element objects.

can i parse this message with xml parsing.

i dont want shell script or commands. pls where can i find parsing program.
help me pls.

osor 07-07-2009 09:06 PM

You are mixing UTF-16 and UTF-8 characters. Make sure to serialize correctly across locales. For a quick fix, try “iconv -f UTF-16 -t UTF-8”.


All times are GMT -5. The time now is 03:02 AM.