Title: Automatic UTF-8 string encoding in Ruby 1.9 can cause unexpected results · Issue #7 · msgpack/msgpack-ruby · GitHub
Open Graph Title: Automatic UTF-8 string encoding in Ruby 1.9 can cause unexpected results · Issue #7 · msgpack/msgpack-ruby
X Title: Automatic UTF-8 string encoding in Ruby 1.9 can cause unexpected results · Issue #7 · msgpack/msgpack-ruby
Description: If encoding is available, unpacked strings are always encoded using UTF-8. This can cause problems if the packed string data was meant to use a different encoding such as ASCII-8BIT. For example, sha = '0123456789aabbcdfeff01234567890123...
Open Graph Description: If encoding is available, unpacked strings are always encoded using UTF-8. This can cause problems if the packed string data was meant to use a different encoding such as ASCII-8BIT. For example, s...
X Description: If encoding is available, unpacked strings are always encoded using UTF-8. This can cause problems if the packed string data was meant to use a different encoding such as ASCII-8BIT. For example, s...
Opengraph URL: https://github.com/msgpack/msgpack-ruby/issues/7
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Automatic UTF-8 string encoding in Ruby 1.9 can cause unexpected results","articleBody":"If encoding is available, unpacked strings are always encoded using UTF-8. This can cause problems if the packed string data was meant to use a different encoding such as ASCII-8BIT. For example,\n\n``` ruby\nsha = '0123456789aabbcdfeff01234567890123456789'\n\npacked = [sha].pack('H*')\n=\u003e \"\\x01#Eg\\x89\\xAA\\xBB\\xCD\\xFE\\xFF\\x01#Eg\\x89\\x01#Eg\\x89\"\n\npacked.encoding\n=\u003e #\u003cEncoding:ASCII-8BIT\u003e\n\nhash = {packed =\u003e 1}\n=\u003e {\"\\x01#Eg\\x89\\xAA\\xBB\\xCD\\xFE\\xFF\\x01#Eg\\x89\\x01#Eg\\x89\"=\u003e1}\n\nrehash = MessagePack.unpack(hash.to_msgpack)\n=\u003e {\"\\u0001#Eg\\x89\\xAA\\xBB\\xCD\\xFE\\xFF\\u0001#Eg\\x89\\u0001#Eg\\x89\"=\u003e1}\n\nhash.has_key? packed\n=\u003e true\n\nrehash.has_key? packed\n=\u003e false\n\nirb(main):085:0\u003e rehash.keys.map{|k| k.encode('BINARY')}\nEncoding::InvalidByteSequenceError: \"\\x89\" on UTF-8\n from (irb):85:in `encode'\n from (irb):85:in `block in irb_binding'\n from (irb):85:in `map'\n from (irb):85\n from /opt/boxen/rbenv/versions/1.9.3/bin/irb:12:in `\u003cmain\u003e'\n```\n","author":{"url":"https://github.com/nickh","@type":"Person","name":"nickh"},"datePublished":"2013-02-27T01:29:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/7/msgpack-ruby/issues/7"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2944d70e-f0bd-b88a-20ec-aa9b63f18135 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D580:27480A:B0AB44:FFCB6E:6A5623B1 |
| html-safe-nonce | dcecb3a0986eacf3ade120e52338476857ecf4e23b78a39c60322742a806ffbe |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENTgwOjI3NDgwQTpCMEFCNDQ6RkZDQjZFOjZBNTYyM0IxIiwidmlzaXRvcl9pZCI6IjI0NjkwNTc4OTI4NjkwODgxNzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 47802b22d758d571805c49b81421ee0bd25a41cda65d15edbba5c149118a97f1 |
| hovercard-subject-tag | issue:11437777 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/msgpack/msgpack-ruby/7/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5546281371281de404577d0e13ebe32c954e4bc2f1e2f3209af508c48291068a/msgpack/msgpack-ruby/issues/7 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5546281371281de404577d0e13ebe32c954e4bc2f1e2f3209af508c48291068a/msgpack/msgpack-ruby/issues/7 |
| og:image:alt | If encoding is available, unpacked strings are always encoded using UTF-8. This can cause problems if the packed string data was meant to use a different encoding such as ASCII-8BIT. For example, s... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nickh |
| hostname | github.com |
| expected-hostname | github.com |
| None | eeb71977be324ce2bc7c4afd597296b8e3527d8922ad94632edd7a7296f8031b |
| turbo-cache-control | no-preview |
| go-import | github.com/msgpack/msgpack-ruby git https://github.com/msgpack/msgpack-ruby.git |
| octolytics-dimension-user_id | 198264 |
| octolytics-dimension-user_login | msgpack |
| octolytics-dimension-repository_id | 2479813 |
| octolytics-dimension-repository_nwo | msgpack/msgpack-ruby |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 2479813 |
| octolytics-dimension-repository_network_root_nwo | msgpack/msgpack-ruby |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3e7957744c8a44d05ff1e464dc5d119e60b98fae |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width