I used this webpage http://javascriptobfuscator.com/default.aspx to obfuscate a small script.
$(document).ready(function(){
$("#likee").fadeOut("fast");
});
And the obfuscated code is:
$(document)["\x72\x65\x61\x64\x79"](function (){$("\x23\x6C\x69\x6B\x65\x65")["\x66\x61\x64\x65\x4F\x75\x74"]("\x66\x61\x73\x74");} );
I am using a form to insert the obfuscated code into mysql. However, when I inserted the code I got this:
$(document)["x72x65x61x64x79"](function (){$("x23x6Cx69x6Bx65x65")["x66x61x64x65x4Fx75x74"]("x66x61x73x74");} );
Does anybody know why backslashes are removed?
Will my code work without backslashes?
I believe it has something to do with the encoding. I guess that you are using the utf8 encoding format for the text/varchar (or some sort) column where the data is inserted in.
The utf8 encoding format only accepts unicode characters that can be represented with 3 bytes, but the \\x23 character needs 4 bytes, so mysql strips the character.
How to solve? Do you have mysql 5.5 or later? You can change the column encoding from utf8 to utf8mb4. This encoding allows characters of 4 bytes.
Source: "Incorrect string value" when trying to insert UTF-8 into MySQL via JDBC?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.