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

invalid argument (invalid byte sequence) #30

Closed
GregorySchwartz opened this issue Jan 26, 2019 · 5 comments
Closed

invalid argument (invalid byte sequence) #30

GregorySchwartz opened this issue Jan 26, 2019 · 5 comments

Comments

@GregorySchwartz
Copy link

I'm getting the error hGetContents: invalid argument (invalid byte sequence) when SVGFonts attempts to read LinLibertine.svg inside of a docker container. Any ideas on how to fix this for docker or is it a locale issue?

@byorgey
Copy link
Member

byorgey commented Jan 29, 2019

Hi @GregorySchwartz , unfortunately it looks like LinLibertine.svg contains a comment on line 7408,

<!--
Möglicherweise eher so wie in der Times?
-->

which contains a single non-ASCII character ö. (This is the only non-ASCII character in the entire file.) This character is in fact encoded using UTF-8, so you need to make sure your encoding is set to UTF-8 when reading the file. If I'm remembering correctly, the encoding gets picked up automatically from the locale setting if you just use hGetContents (which probably explains why it works for you locally but not inside a docker container---the locale settings are different inside the container), but I think (?) you should be able to set the encoding manually. I forget the details of how to do this though.

@GregorySchwartz
Copy link
Author

Yes, I fixed it in docker with:

RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

and installing locales. I also needed to copy the install folder containing LinLibertine.svg to a build folder in the docker filesystem containing the executable. I assume there is no easier solution?

@byorgey
Copy link
Member

byorgey commented Jan 29, 2019

Well, if you're copying LinLibertine.svg anyway, I suppose you could also simply delete lines 7407-7409.

@byorgey
Copy link
Member

byorgey commented Jan 29, 2019

This is also easy enough to fix upstream, in a minute I'll upload a point release of SVGFonts that removes the non-ASCII character.

@byorgey
Copy link
Member

byorgey commented Jan 29, 2019

Uploaded SVGFonts-1.7.0.1.

@byorgey byorgey closed this as completed Jan 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants