I need to update a field into database using Ajax and PHP.
It works fine but when there are special characters like following
اللهم اني اشكو اليك ضعف قوتي وقلة حيلتي وهواني علي الناس
Th开发者_Python百科e script inserts junk data into the database.
I tried using escape() of javascript to do URL encoding, it encodes the data but when I decode it using PHP it again shows junk values.
You can try using encodeURIComponent
instead of escape
, that will give you something like this:
%D8%A7%D9%84%D9%84...
whereas escape
would yield:
%u0627%u0644%u0644%u0647...
and the unicode escapes might be confusing someone.
精彩评论