编码类型有问题吗? [英] Encoding Type issue?

查看:132
本文介绍了编码类型有问题吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在TCP通信中,从客户端向主机传递了一个字符串,发生了这种情况:

客户端发送的消息:

< open>
< feed1 type ="feedbyyou">
< door1 id ="/>
< open/>

主机收到的消息:

< open> \ n< feed1 type = \"feedbyyou \"> \ n< door1 id = \"\"/> \ n</open>


为什么会这样呢?客户端程序和主机程序都是C ++.谁能帮我理解?

谢谢.
Nuno

Hi, in a TCP communication where a string is passed from the client to the host this happens:

Sent message by the client:

<open>
<feed1 type="feedbyyou">
<door1 id=""/>
<open/>

Received message by the host:

<open>\n <feed1 type=\"feedbyyou\">\n <door1 id=\"\"/>\n</open>


Why is this happening? The client program is in C++ as well as the host program. Can anyone help me understand?

Thank you.
Nuno

推荐答案

这里的问题是什么.您已准确接收到发送的内容.

''\ n''是新行char
消息中的''\''用作转义字符.
what is the issue here. You recieved exactly what is sent.

''\n'' is new line char
''\'' in the message is used as escape char.


这篇关于编码类型有问题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆