Skip to content

Instantly share code, notes, and snippets.

@jacyzon
Created July 22, 2015 04:30
Show Gist options
  • Select an option

  • Save jacyzon/e312db922c740f42e5a8 to your computer and use it in GitHub Desktop.

Select an option

Save jacyzon/e312db922c740f42e5a8 to your computer and use it in GitHub Desktop.
p "測試".each_byte.map { |b| b.to_s(16) }.join .scan(/../).map { |x| x.hex.chr }.join
# output: "\xE6\xB8\xAC\xE8\xA9\xA6"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment