开发者

Error while parsing text file but not after opening/saving it in Textmate

I'm parsing hand histories from Pokerstars.

I'm getting the following error when I try to parse the hands directly from the Pokerstars file:

Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id

What is really strange is that I'm totally successful parsing the same content with hundreds of hands if I have copied/pasted the text from the pokerstars text file into Textmate and having saved the Textmate .txt file.

I'm thinking it might have to do with the line breaks or the utf-8 encoding which Textmate defaults to but I don't have enough understanding of these issues to fix the problem.

EDIT

I have now determined that the Pok开发者_开发技巧erstars file is UTF-8 encoded. My next suspect is the end of line character issue.

Any idea on how to check with EOL characters are used in file? and in changing those to a new one?

Any other ideas? Something I might be missing?


I suspect the cause of the problem is BOM, take a look for example here:

http://naturalcode.wordpress.com/2008/08/30/ruby-19-and-unicode-the-bom-will-fuck-your-shit-up/

How to avoid tripping over UTF-8 BOM when reading files

and google further if that particular answer doesn't help.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜