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

unexpected encoding #5

Closed
siuying opened this issue Dec 5, 2012 · 1 comment
Closed

unexpected encoding #5

siuying opened this issue Dec 5, 2012 · 1 comment

Comments

@siuying
Copy link

@siuying siuying commented Dec 5, 2012

I noticed the strings in the unpacked data structures seems always use "ASCII-8BIT".

For example in following test case:

# encoding: utf-8
Encoding.default_internal = Encoding.default_external = "UTF-8"

describe "Encoding" do 
  it "should encode properly" do
    json = {"data"=> MessagePack.pack(["かんじ"]) }
    data = json["data"]
    data_unpacked = MessagePack.unpack(data)
    data_unpacked.first.encoding.name.should == "UTF-8"
  end
end

In MRI with msgpack-ruby it pass but in JRuby using msgpack-jruby it always returned "ASCII-8BIT" strings.

@iconara
Copy link
Owner

@iconara iconara commented Dec 5, 2012

Thanks!

We released a version of the gem earlier today that lets you pass in encoding, but I guess that defaulting that to default_external would make a lot of sense.

@iconara iconara closed this Apr 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants