gma / nesta

File Based CMS and Static Site Generator
http://nestacms.com
MIT License
902 stars 120 forks source link

It is impossible to use cyrillic or other UTF-8 symbols in articles and headers #158

Closed k2m30 closed 4 months ago

k2m30 commented 9 years ago

invalid byte sequence in US-ASCII (Argument Error), models.rb:163

I made changes in Gemfile, as suggested here

Encoding.default_external = Encoding::UTF_8 Encoding.default_internal = Encoding::UTF_8

Also I changed Google Font link accordingly to make it support cyrillic. And now it works perfectly.

Hope this helps.

gma commented 9 years ago

Thanks for that – much appreciated.

gma commented 4 months ago

I'm closing this, having just taken another look at what might have been causing it. On line 163 of models.rb at this time, was this method call:

first_paragraph, remaining = contents.split(/\r?\n\r?\n/, 2)

Having read the SO thread that k2m30 posted, I'm imagining that Ruby was interpreting escape characters differently with whatever locale happened to be set on their system.

If this was a common problem I'm sure we'd have had more reports of it on this bug since then, so I'm going to close it.

I also like the approach recommended on SO of setting environment variables to modify the behaviour (i.e. no code changes required). So I'm closing it for now.