Comments (7)
simple workaround:
var b64str = $.base64.encode(unescape(encodeURIComponent(string_to_encode)))
This will breakup UTF8 chars into their component bytes and then pass to to the base 64 encode routine. unescape is not UTF8 aware to it treats each % encoded byte as a single character.
window.atob()
requires the same workaround.
Although unescape
is deprecated, and may start to disappear from modern browsers (ref https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/unescape)
from jquery-base64.
Oh, this is a shame! I was going to use for utf and I got the same error
from jquery-base64.
I wish I'd seen this earlier, it would've saved me some trouble. :(
I wound up using the suggestions in the following stackoverflow question.
http://stackoverflow.com/questions/246801/how-can-you-encode-to-base64-using-javascript
(Since there is a whole source code + multiple suggestions on how to implement base64 in javascript there, I simply cut-and-pasted to get all of the goodies in one file.)
from jquery-base64.
+1
from jquery-base64.
+1 to fix
from jquery-base64.
@tmorehouse Thanks!
from jquery-base64.
for asp.net developers, return your JSON as:
return Json(model, "application/json" ,System.Text.Encoding.ASCII, JsonRequestBehavior.AllowGet);
from jquery-base64.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery-base64.