Skip to content

Conversation

kjg
Copy link
Contributor

@kjg kjg commented Mar 31, 2016

by treating it as ascii as well as ignoring any invalid chars

@kjg kjg force-pushed the b_value_unknown_encoding branch from fcb5de9 to 6c0510f Compare March 31, 2016 15:26
@kjg
Copy link
Contributor Author

kjg commented Mar 31, 2016

Quick question: How would you feel about replacing invalid chars with "�" instead of "". That way it is clear that something went "wrong" during translation where we otherwise just pretend everything was okay with no notice.

@jeremy
Copy link
Collaborator

jeremy commented Mar 31, 2016

Good call on � 👍

@kjg
Copy link
Contributor Author

kjg commented Mar 31, 2016

Should I change that in this PR or a new one?

Any idea offhand how to get Iconv to do � in 1.8.7?

If it isn’t easy / built in to Iconv, is it worth it to add for 1.8.7, or should I do it just for the String#encode versions?

@kjg
Copy link
Contributor Author

kjg commented Mar 31, 2016

Yeah, as far as I can tell, There is no good way to specify a replacement character in 1.8.7. Any 1.8.7 solution that I can think of to replace invalid characters would involve iterating over bytes and be really messy.

So the question becomes do we scrap � and leave the replacement as "" across the board, or do we allow the 1.8.7 output to be different.

I vote for allowing the 1.8.7 output to be slightly different.

@bf4
Copy link
Contributor

bf4 commented Apr 1, 2016

@kjg Maybe https://github.com/bf4/encoded_string/blob/master/lib/encoded_string.rb#L14-L19 helps? I don't have 1.8.7 to test

@jeremy
Copy link
Collaborator

jeremy commented Apr 1, 2016

Separate PR makes sense.

by treating it as ascii as well as ignoring any invalid chars
@kjg kjg force-pushed the b_value_unknown_encoding branch from 6c0510f to 78600da Compare April 1, 2016 20:24
@kjg
Copy link
Contributor Author

kjg commented Apr 2, 2016

This is passing now after a rebase. I'll make the replacement character change in a separate PR

@jeremy jeremy merged commit dcf39bf into mikel:master Apr 3, 2016
@jeremy jeremy added this to the 2.7.0 milestone Apr 3, 2016
@kjg kjg deleted the b_value_unknown_encoding branch April 4, 2016 13:54
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.

3 participants