Code Monkey home page Code Monkey logo

Comments (2)

GoogleCodeExporter avatar GoogleCodeExporter commented on June 1, 2024
When you write non-ASCII characters directly into your page source, you need to 
make sure you use a meta tag to set the charset. To see the difference it 
causes, consider these two sources below.


/* No META charset */
<script type="text/javascript" 
src="http://crypto-js.googlecode.com/files/2.0.0-crypto-sha256.js"></script>
<script type="text/javascript">
var m = "á";
alert(m.length); // alerts 2
alert(Crypto.SHA256(m)); // alerts 
eb3e85d7fbf56104c8021681e68d771b9b9205b93e9219c8f81f60af703de381
</script>


/* Has META charset */
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" 
src="http://crypto-js.googlecode.com/files/2.0.0-crypto-sha256.js"></script>
<script type="text/javascript">
var m = "á";
alert(m.length); // alerts 1
alert(Crypto.SHA256(m)); // alerts 
fb9778719d93551b1c88df5f1ab229f83ea30af112fc51017c9f0a383dcf6cb3
</script>

Original comment by Jeff.Mott.OR on 17 Nov 2010 at 5:21

from crypto-js.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 1, 2024

Original comment by Jeff.Mott.OR on 18 Nov 2010 at 5:52

  • Changed state: Invalid

from crypto-js.

Related Issues (20)

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.