<div dir="ltr">thanks! Alex!<div><br></div><div> I got it</div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-02-11 12:37 GMT+08:00 Alex Afanasyev <span dir="ltr"><<a href="mailto:aa@cs.ucla.edu" target="_blank">aa@cs.ucla.edu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span class=""><blockquote type="cite"><div>On Feb 10, 2017, at 7:30 PM, 呂建德 <<a href="mailto:v0918732669@gmail.com" target="_blank">v0918732669@gmail.com</a>> wrote:</div><br class="m_-4053849776036034927Apple-interchange-newline"><div><div dir="ltr">I test the same code on three platfoms like below.<div><br></div><div><a href="http://imgur.com/a/9e38l" target="_blank">http://imgur.com/a/9e38l</a></div><div><br></div><div>and the first one is mac os, second one is mint based on ubuntu16.04, the last one is ubuntu16.04 LTS.</div><div><br></div><div>the code in ndn-producer is </div><div><div>data->setContent(::ndn::<wbr>encoding::makeStringBlock(::<wbr>ndn::tlv::Content, str));<br></div></div><div><br></div><div>the code in ndn-consumer is</div><div>NS_LOG_INFO("< DATA for " << data->getContent().value());<br></div></div></div></blockquote><div><br></div><div><br></div></span><div>This is not the proper way of interpreting content as a string.  This will try to interpret bytes carried in the content as a null-terminated string, which the content probably isn't.</div><div><br></div><div>Use this, a bit more explicit, way:</div><div><br></div><div>std::string stringValue(data->getContent()<wbr>.value(), data->getContent().value_size(<wbr>));</div><span class=""><div><br></div><div><br></div><blockquote type="cite"><div><div dir="ltr"><div><br></div><div>I dont know what happened on these platforms, the same code ,the different result. orz</div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="m_-4053849776036034927gmail-h5"><br></div></div>
</blockquote></div><br></div></div>
</div></blockquote></span></div><br></div></blockquote></div><br></div>