Skip to content

Instantly share code, notes, and snippets.

@Hakon
Created April 23, 2012 17:03
Show Gist options
  • Save Hakon/2472311 to your computer and use it in GitHub Desktop.
Save Hakon/2472311 to your computer and use it in GitHub Desktop.
# encoding: utf-8
require "json"
# Expected (and MRI behavior):
str = JSON.parse('{"a":"\u00f8"}')["a"]
str == "ø"
str.encoding.to_s == "UTF-8"
# Actual (jruby behavior):
str = JSON.parse('{"a":"\u00f8"}')["a"]
str == "\u00C3\u00B8"
str.encoding.to_s == "ASCII-8BIT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment