Giter Site home page Giter Site logo

Comments (7)

tmorehouse avatar tmorehouse commented on July 18, 2024 5

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.

josefig avatar josefig commented on July 18, 2024

Oh, this is a shame! I was going to use for utf and I got the same error

from jquery-base64.

zrajm avatar zrajm commented on July 18, 2024

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.

vote539 avatar vote539 commented on July 18, 2024

+1

from jquery-base64.

born2net avatar born2net commented on July 18, 2024

+1 to fix

from jquery-base64.

wieczorek1990 avatar wieczorek1990 commented on July 18, 2024

@tmorehouse Thanks!

from jquery-base64.

fynman avatar fynman commented on July 18, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.