How can I do Base64 encoding in Node.js?

Does Node.js have built-in Base64 encoding yet? The reason why I ask this is that final() from crypto can only output hexadecimal, binary or ASCII data. For example: var cipher = crypto.createCipheriv(‘des-ede3-cbc’, encryption_key, iv); var ciph = cipher.update(plaintext, ‘utf8’, ‘hex’); ciph += cipher.final(‘hex’); var decipher = crypto.createDecipheriv(‘des-ede3-cbc’, encryption_key, iv); var txt = decipher.update(ciph, ‘hex’, ‘utf8’); … Read more

When are you supposed to use escape instead of encodeURI / encodeURIComponent?

When encoding a query string to be sent to a web server – when do you use escape() and when do you use encodeURI() or encodeURIComponent(): Use escape: escape(“% +&=”); OR use encodeURI() / encodeURIComponent() encodeURI(“http://www.google.com?var1=value1&var2=value2”); encodeURIComponent(“var1=value1&var2=value2”); 1 15 escape() Don’t use it! escape() is defined in section B.2.1.2 escape and the introduction text of … Read more

If a hacker changed the blog_charset to UTF-7 does that make WordPress vulnerable to further attacks?

I had a client who got hacked recently and I noticed that there were weird characters appearing on her site, like  and Æ. It turns out that the hackers changed the blog_charset to UTF-7 in the wp_options table in the database. I set it back to UTF-8, but I was wondering if during the … Read more

“Unmappable character for encoding UTF-8” error

I’m getting a compile error at the following method. public static boolean isValidPasswd(String passwd) { String reg = “^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[~#;:?/@&!\”‘%*=¬.,-])(?=[^\\s]+$).{8,24}$”; return Pattern.matches(reg, passwd); } at Utility.java:[76,74] unmappable character for enoding UTF-8. 74th character is’ ” ‘ How can I fix this? Thanks.