-
Notifications
You must be signed in to change notification settings - Fork 146
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
Fog::JSON::EncodeError when using to_json on servers collection #345
Comments
These chars are coming from the metadata "fingerprint" item, btw |
@imriz - acknowledged. I’m doing some work on SQL tomorrow so I’ll take a look. |
Was able to repro this:
Fingerprint is:
Model field is actually:
Hash returned by Google API Lib has an ASCII encoding...
I'm not that savvy with encoding issues, @icco @plribeiro3000 - any idea on a non-hacky way to force model fields to utf-8? Or is this something we need to file upstream to Google API client? |
After reading through this @Temikus, I'm like 70% sure It's either a bug with the api-client, how api-client is using multi-json or multi-json itself. Everything should utf-8, so I'm confused why we're ever in the state of |
Found the problem:
I'll need to pass a client option in, I'll get to it by EOW next week (probably sooner). |
Nice find!
|
Hmmm, just tried those options - that's not it. It seems that the behaviour is correct from Google API client point of view - discovery doc labels the field as bytes, so it returns byte strings. Hmmm, I need to think about it... |
So, in short - this is not an entirely easy problem. The thing here is -
JSON as a format doesn't support byte strings. There are some possible workarounds like encoding options but due to us using So the question here is - is anyone going to use this to marshall objects? If so - we'll need to extend Fog::JSON If this is only for dumping the information to display it somewhere - I can probably override the @icco @plribeiro3000 - do you have any thoughts about this? You guys are more experienced so maybe I'm missing something. @imriz - Can you let me know about your use case a bit more? E.g. are you using json to just display data or... ? |
Uhm, hmm. TIL about json not supporting it. I'd be supportive of fixing fog:json if it's something useful, but that depends on if it's a bug and not just something people want for testing. |
Our use case is local caching of huge lists of instances/disks/snapshots. |
@imriz Understood. Thank you! Do you decode(unmarshal) them back to a I'm asking since making a backwards-incompatible json dump (changing json string to a set of UTF8 characters) is relatively easy. Modifying |
This issue has been marked inactive and will be closed if no further activity occurs. |
Fog versions:
fog-core (2.1.0)
fog-google (1.3.3)
fog-json (1.1.0)
Code I used to reproduce:
I get the following error:
Any ideas what I am doing wrong?
The text was updated successfully, but these errors were encountered: