'Rails credentials escaping OpenSSL cipher key

I'm trying to store a raw OpenSSL cipher key inside rails credentials file but, during the retrival, value gets escaped and it's not working anymore when i try to use it as an actual key.

# credentials.yml
cipher_key: "\xCC\x7Ft%\xEA\xAD\x15u^\xB9W1\xB2m\x7FDZr\x04C\xE24\x93\xCFz4\x89\x7F-g\xBE5"

# Rails console
3.1.1 :001 > Rails.application.credentials.cipher_key
 => "Ì\u007Ft%ê­\u0015u^¹W1²m\u007FDZr\u0004Câ4\u0093Ïz4\u0089\u007F-g¾5"

Is there any way to retrieve the raw value of rails credential?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source