1

我从文件中读取简单的字符串,但是当我看到变量值时,我一直看到垃圾,我该如何清理它?

string line;
ifstream fp_in;  // declarations of streams fp_in and fp_out
fp_in.open("test.txt",std::ios_base::in);    // open the streams
if(fp_in.is_open())
{
    while ( !fp_in.eof() )
        {       
        getline (fp_in,line,'\n');
...
...

但在“line”字符串的乞求中,我看到:ן»¿{"data":[{"id":"19513xxxx46141_326xxxx15447", ......
我怎样才能摆脱它?

4

1 回答 1

2

http://en.wikipedia.org/wiki/Byte_order_mark#UTF-8

于 2011-11-30T13:29:54.067 回答