My code changes when I embed it in MySQL

I used this web page http://javascriptobfuscator.com/default.aspx to trick a little script.

$(document).ready(function(){ $("#likee").fadeOut("fast"); }); 

And the confusing code:

 $(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 embed shredded code in mysql. However, when I pasted the code, I got the following:

 $(document)["x72x65x61x64x79"](function (){$("x23x6Cx69x6Bx65x65")["x66x61x64x65x4Fx75x74"]("x66x61x73x74");} ); 

Does anyone know why the backslash is removed?

Will my code work without backslashes?

+4
source share
1 answer

I believe this has something to do with the encoding. I assume that you are using the utf8 encoding format for the text / varchar column (or some kind) in which the data is inserted.

The utf8 encoding format accepts only Unicode characters, which can be represented by 3 bytes, but 4 bytes are required for the \ x23 character, 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 accepts 4 byte characters.

Source: "Invalid string value" when trying to insert UTF-8 into MySQL via JDBC?

0
source

Source: https://habr.com/ru/post/1484258/


All Articles