lazarus中json解析时“string exceeds end of line”错误
Lazarus 0.9.31
jp:=TJSONParser.Create(UTF8Encode(pl));
try
adList:=jp.Parse as TJSONArray;
报错:
An exception was raised on the server: string exceeds end of line
其中,pl包含从memo中返回的text值,用superobject的asjson(false,false)编码
其实,就是包含了”’#10’”的字符
原因:
参考:
Lazarus的 文档:Scanner messages.
http://www.freepascal.org/docs-html/user/userse61.html
Fatal: String exceeds line There is a missing closing ’ in a string, so it occupies multiple lines.
可见,是因为回车中的换行字符的单引号引起的。
解决办法:
使用tstrings的commatext属性代替text属性即可。
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。