Searching through my application’s uncaught exception logs ( js -> php -> vb6 dll ) i noticed a weird error:
file: /displaywords_GET.php?GreekWord=%E1%ED%E8%F1%F9%F0%EF%EC%DE%ED%E1%F2&selectedRes=1 # <b>Source:</b> mydll<br/><b>Description:</b> Invalid procedure call or argument # Variables:
# Array
(
[GreekWord] => ανθρωπομήνας
[selectedRes] => 1
)
so the exception in the .dll occurs for the given parameters. I tested it myself in the app by entering the specific word and the error did not occur. Then I tested to see by entering the encoded URL directly in the address bar and the error was reproduced. So in order to see if there is something wrong with the encoding, i did in javascript
encodeURIcomponent("ανθρωπομήνας")
and the result is :
%CE%B1%CE%BD%CE%B8%CF%81%CF%89%CF%80%CE%BF%CE%BC%CE%AE%CE%BD%CE%B1%CF%82
which is very different from the GET parameter above in the php log. Then i tried to decode the url get parameter as seen in the php file with :
decodeURIcomponent("%E1%ED%E8%F1%F9%F0%EF%EC%DE%ED%E1%F2")
and javascript says : malformed URI sequence. Why is this happening ? Obviously the application crashes because the particular URL parameter is malformed, not a proper one.
Now, my problem is, how can I see if the encoded string is a proper one or a corrupted one ? ( Though I’m not sure why php seems to decode it kind of correctly in the logs, when javascript says it’s malformed ).
thanks in advance!
%E1%ED...is the URL-encoding of the string as represented in the ISO-8859-7 character set. You will need to convert to the UTF-8 encoding before URL-encoding the bytes, since JavaScript will only work with UTF-8 strings.