Skip to content
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

Base64 Data #21

Closed
Cretezy opened this issue Aug 21, 2019 · 5 comments
Closed

Base64 Data #21

Cretezy opened this issue Aug 21, 2019 · 5 comments

Comments

@Cretezy
Copy link

Cretezy commented Aug 21, 2019

It would be nice to support base64 for the data, hence avoiding multiple problems of having to deal with encoding JSON in the URL.

@typpo
Copy link
Owner

typpo commented Aug 21, 2019

That's a good idea, I'll see what I can do. In the meantime, do you want to share your difficulty URL-encoding the JSON? I would imagine base64 encoding is no more difficult than URL encoding, as most languages have built-in libraries capable of doing both.

@Cretezy
Copy link
Author

Cretezy commented Aug 21, 2019

It could help with handling of the pound symbol for sure, it's a lot more trouble to have to convert hex -> rgb than just base64 it 😋

@typpo
Copy link
Owner

typpo commented Aug 21, 2019

Hmm, I think your URL encoder should handle pound signs though! For example, in Javascript:

> encodeURIComponent('color:#abc123')
'color%3A%23abc123'

typpo added a commit that referenced this issue Aug 21, 2019
@typpo
Copy link
Owner

typpo commented Aug 21, 2019

Goods news, I've just added support for base64 encoding! Although you could theoretically solve your problem with URL encoding, base64 is more compact and it plays nicer with unicode :)

Here's an example:

https://quickchart.io/chart?encoding=base64&c=ew0KICB0eXBlOiAnYmFyJywNCiAgZGF0YTogew0KICAgIGxhYmVsczogWydKYW51YXJ5JywgJ0ZlYnJ1YXJ5JywgJ01hcmNoJywgJ0FwcmlsJywgJ01heSddLA0KICAgIGRhdGFzZXRzOiBbew0KICAgICAgbGFiZWw6ICdEb2dzJywNCiAgICAgIGRhdGE6IFsgNTAsIDYwLCA3MCwgMTgwLCAxOTAgXQ0KICAgIH0sIHsNCiAgICAgIGxhYmVsOiAnQ2F0cycsDQogICAgICBkYXRhOiBbIDEwMCwgMjAwLCAzMDAsIDQwMCwgNTAwIF0NCiAgICB9XQ0KICB9DQp9

image

Docker package is updated as well. Let me know if you have any issues!

@typpo typpo closed this as completed Aug 21, 2019
@Cretezy
Copy link
Author

Cretezy commented Aug 22, 2019

Ah you're totally right about #! The README slightly confused me.

Anyways thanks, this is an awesome feature!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants