新手问题 16 进制转 GBK 不成功

bluexuemei · January 19, 2015 · Last by est replied at January 20, 2015 · 2348 hits

"AA3F3201861F0000D61F0000".scan(/..../).map{|x| x.to_i(16)}.pack("U*") 这个可以,但是 "AA3F3201861F0000D61F0000".scan(/..../).map{|x| x.to_i(16)}.pack("U*").encode('gbk') 不成功,怎么解决?

["AA3F3201861F0000D61F0000"].pack('H*').encode('gbk', replace: '') => "?2\x01\x1F\x00\x00\x1F\x00\x00"

You need to Sign in before reply, if you don't have an account, please Sign up first.