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

Check Before Re-encoding #1

Merged
merged 2 commits into from
Apr 18, 2019
Merged

Commits on Apr 18, 2019

  1. Check to see if @normalized_* variables are already UTF-8 before

    calling force_encoding on them
    
    This prevents unnecessary mutation of these variables when already set
    and appropriately encoded. Necessary for our use case as we freeze our
    Addressable::URI objects to ensure they don't get changed when passed around
    ACBullen committed Apr 18, 2019
    Configuration menu
    Copy the full SHA
    686dbbb View commit details
    Browse the repository at this point in the history
  2. Use encode! instead of force_encoding where applicable

    Calling force_encoding doesn't actually change anything about the string,
    it just changes what the string considers its encoding to be, allowing you
    to end up with strings with invalid encodings. There are some invocations
    in Addressable::URI where this seems intentional (followed by some g_sub'ing)
    but at least at the output stage it seems like the strings should be converted
    and the non-utf-8 bytes/characters removed
    ACBullen committed Apr 18, 2019
    Configuration menu
    Copy the full SHA
    bfc9a44 View commit details
    Browse the repository at this point in the history