3

I'm using slim framework, and recently my log shows that I'm getting many uri requests which are not encoded as utf-8. the text is expected to be in Hebrew, but the value is decoded to some kind of gibberish.

for example I found the following missing uri in the log: /product/%c3%97%c2%a0%c3%97%e2%80%a2%c3%97%c2%a8%c3%97%e2%80%9d_%c3%97%c5%93%c3%97%c5%be%c3%97%c2%a7%c3%97%c2%a8%c3%97%c2%a8_120V_40W

which is decoded to /product/נורה_למקרר_120V_40W while I'm expecting /product/נורה_למקרר_120V_40W

I'm not sure who is requesting this uri since I couldn't get niter referrer nor user-agent. however I can add more variables to the log if needed, just couldn't think about something informative in that case.

Thanks, Meir

2
  • I found this site: link which helped me figuring out it's a 'Windows-1254' encoding. I tried use $name = iconv("windows-1254" , "UTF-8//IGNORE" , $name) and mb_convert_encoding($name, 'UTF-8','Windows-1254') but it's still gibberish
    – meirlo
    Sep 11, 2015 at 7:52
  • Update 2: Using mb_convert_encoding($name, 'Windows-1254','UTF-8') I'm now getting נורה_ל�?קרר_120V_40W which is a bit similar to the expected text, but still something is missing. Any ideas?
    – meirlo
    Sep 11, 2015 at 8:34

1 Answer 1

0

This worked: $name = mb_convert_encoding($name, 'Windows-1252','UTF-8');

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.