I run thin locally on my mac, and the article is rendered correctly, without any problems. However, on heroku, the article is rendered incomplete.
the article text: http://idzr.org/4v37 (text encoding utf-8)
I don't really know how to describe the problem. When you go to alfredluk.heroku.com, and view the source code, the html is incomplete, and is truncated somewhere, both at the index page and the single article page. I don't know if it's related to the charset, but I've tested using english articles and they're fine on heroku. Again, my chinese article is rendered correctly and complete on the local thin server. It just has such problem on heroku.
Any help is greatly appreciated. Thank you!
The problem is the meaning of String#size has changed between ruby 1.8 and ruby 1.9. In 1.8, String#size returns the number of bytes in the string (no encoding information is stored, so it’s all it can really do). In 1.9, String#size returns the number of characters, which for multi-byte encoding is less than the number of bytes. Toto assumes 1.8, so it sets the response header Content-Length to String#size (the lesser value in 1.9), which is why your content is truncated.
There is a fix at mikedouglas/toto@3c3217b.
Thank you Mike! I don't know how to modify the files on the server. But I managed to migrate the stack on Heroku from 1.9 to 1.8 and it works! Thanks again!