Skip to content

Instantly share code, notes, and snippets.

@mtarnovan
Created May 9, 2016 13:40
Show Gist options
  • Save mtarnovan/bb8500e81629620335eb9fd438c80a3d to your computer and use it in GitHub Desktop.
Save mtarnovan/bb8500e81629620335eb9fd438c80a3d to your computer and use it in GitHub Desktop.
# a mapping from turkish to romanian code points
# Ş => Ș etc
TURKISH_TO_ROMANIAN = {
350 => 536,
351 => 537,
354 => 538,
355 => 539
}.freeze
def turkish_to_romanian(string)
string.unpack('U*').map! { |x| TURKISH_TO_ROMANIAN[x] || x }.pack('U*')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment