Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read theme file using UTF-8 encoding #533

Closed
mojavelinux opened this issue Sep 3, 2016 · 2 comments
Closed

Read theme file using UTF-8 encoding #533

mojavelinux opened this issue Sep 3, 2016 · 2 comments
Assignees

Comments

@mojavelinux
Copy link
Member

Asciidoctor PDF should be able to read a theme file containing characters outside the ASCII range even when the system is not configured to use UTF-8 encoding. To support this scenario, the theme file should be force encoded (i.e., coerced) to UTF-8 encoding.

@mojavelinux mojavelinux added this to the v1.5.0.alpha.13 milestone Sep 3, 2016
@mojavelinux mojavelinux self-assigned this Sep 3, 2016
@mojavelinux
Copy link
Member Author

To test, use a non-ASCII character in the running content (e.g., Romé), then set the LANG environment variable to C when invoking asciidoctor-pdf:

LANG=C bundle exec ./bin/asciidoctor-pdf sample.adoc

mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Sep 3, 2016
@mojavelinux
Copy link
Member Author

mojavelinux commented Sep 3, 2016

Actually, since Asciidoctor PDF requires at least Ruby 1.9.3, we can simply set the encoding when reading the file.

IO.read filename, encoding: ::Encoding::UTF_8

@mojavelinux mojavelinux changed the title Coerce theme file to UTF-8 encoding Read theme file using UTF-8 encoding Sep 3, 2016
fapdash pushed a commit to vogellacompany/asciidoctor-pdf that referenced this issue Dec 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant