Home ruby encode "\x\x" format to utf8 string or store in rails postgres db in current form
Reply: 0

ruby encode "\x\x" format to utf8 string or store in rails postgres db in current form

user655
1#
user655 Published in April 21, 2018, 3:27 pm

I created at sha256 in a solidity contract and it returns

"Y\xED\x90b\x82\xCDz\xCC\xD4\xA2\xD7\x9E\a\xBB\x13-'\xCC\xA2\x1F\x04Kv%!\xB6\xE8\xF8\xE9\xCB \x8B"

Then when trying to save in postgres in a string data type field, I get

ActiveRecord::StatementInvalid (PG::CharacterNotInRepertoire: ERROR: invalid byte sequence for encoding "UTF8": 0xed 0x90 0x62

What is the best way to either store as is in rails and postgres or convert it to a UTF8 string?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.305501 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO