Login  Register

Re: German special Characters ( incompatible character encodings: CP850 and UTF-8)

Posted by mojavelinux on May 02, 2013; 2:03am
URL: https://discuss.asciidoctor.org/German-special-Characters-incompatible-character-encodings-CP850-and-UTF-8-tp175p176.html

Manfred,

Thank you for reporting this issue. A similar issue was reported this morning. I decided to take action on it. I've since applied a fix (which is pending review).

https://github.com/asciidoctor/asciidoctor/issues/308

Long story short, Asciidoctor was properly handling non-Ascii characters *if* the system encoding was set to UTF-8. When the system encoding was changed to something other than UTF-8 (such as US-ASCII or CP850), Asciidoctor was unable to handle a string containing a UTF-8 character because Ruby would complain the encodings are incompatible.

If fixed this problem by forcing the encoding for any input data to UTF-8 if the system encoding is something other than UTF-8. I've also made the tests around string encoding even more rigorous, so if a bug appears, the tests will fail spectacularly.

In the meantime, the workaround is to use the -E flag to explicitly set the default encoding when running Ruby.

ruby -E UTF-8 my_script.rb

This is the recommended practice for running Ruby in production. When the default encoding is set to UTF-8, non of the force encoding code will be used.

Hope that helps!

-Dan

p.s. To emulate the encoding problem on any system (or test the fix), you simply set the encoding to something other than UTF-8 when running Ruby:

ruby -E US-ASCII my_script.rb

or

LANG=C ruby my_script.rb

or

LANG=US-ASCII my_script.rb



On Tue, Apr 30, 2013 at 8:49 AM, mbw [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi all,

rendering a text with Asciidoctor, I alway get this error - only when using german sepcial characters (äöüßÄÜÖ).
If I don't use german special characters (or html-entities), all works fine.
Windows 7 / 64-Bit

CompatibilityError: incompatible character encodings: CP850 and UTF-8

On rendering with asciidoc - all works fine.

Any Ideas?

thanks, Manfred




If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/German-special-Characters-incompatible-character-encodings-CP850-and-UTF-8-tp175.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen
Principal Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597

http://google.com/profiles/dan.j.allen
http://mojavelinux.com
http://mojavelinux.com/seaminaction