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

Fix iconv error handling #3306

Merged

Conversation

ysbaddaden
Copy link
Contributor

@ysbaddaden ysbaddaden commented Sep 14, 2016

Corrects the detection of iconv_open returning an error, and raises Errno when iconv_close fails.

I also added the missing Errno::E2BIG constant.

fixes #3271

@ysbaddaden
Copy link
Contributor Author

Oh, I didn't notice that it failed on linux/x86...

@asterite
Copy link
Member

@ysbaddaden Sometimes builds stall, I don't know why. I just restarted it, let's see what happens...

@asterite
Copy link
Member

Oh, but now we are missing an update of crystal in linux/x86 to run on travis...

Verified

This commit was signed with the committer’s verified signature.
wyattjoh Wyatt Johnson

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@ysbaddaden ysbaddaden force-pushed the core-fix-iconv-error-handling branch from 37cbff2 to a41a742 Compare September 26, 2016 15:35
elsif original_to == "UTF-8"
raise ArgumentError.new("invalid encoding: #{original_from}")

if @iconv.address == LibC::SizeT.new(-1)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha: the address is architecture dependent!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe Pointer#address's type should change depending on the platform, I'm not sure.

@asterite
Copy link
Member

@ysbaddaden Thank you for this!

@asterite asterite merged commit bf6b743 into crystal-lang:master Sep 26, 2016
@ysbaddaden ysbaddaden deleted the core-fix-iconv-error-handling branch November 7, 2016 13:47
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

Successfully merging this pull request may close these issues.

invalid encoding: UTF-8 (ArgumentError) on FreeBSD
2 participants