UrlEncode Problem
-
Hello everybody in this forum when i encode non ascii characters in post method in http using HTTPUtility.URLEncode in C# it gives me an output of encoded string but when i encode the same word in php using urlencode function it gives me a different output in php it is almost the half encoded string from the one from C# output. the word that is encoded is : السلام عليكم in C# ====== %d8%a7%d9%84%d8%b3%d9%84%d8%a7%d9%85+%d8%b9%d9%84%d9%8a%d9%83%d9%85 in php : ======== %C7%E1%D3%E1%C7%E3%20%DA%E1%ED%DF%E3 Almost the half string in php output i need to output in C# the same encoded string as the output from php i don't know how to make it
Human knowledge belongs to the world.
-
Hello everybody in this forum when i encode non ascii characters in post method in http using HTTPUtility.URLEncode in C# it gives me an output of encoded string but when i encode the same word in php using urlencode function it gives me a different output in php it is almost the half encoded string from the one from C# output. the word that is encoded is : السلام عليكم in C# ====== %d8%a7%d9%84%d8%b3%d9%84%d8%a7%d9%85+%d8%b9%d9%84%d9%8a%d9%83%d9%85 in php : ======== %C7%E1%D3%E1%C7%E3%20%DA%E1%ED%DF%E3 Almost the half string in php output i need to output in C# the same encoded string as the output from php i don't know how to make it
Human knowledge belongs to the world.
Actually if there is some unicode, the querystring sometimes bigger than what needed. I dont know what is happening inside urlencode of PHP. Perhaps it should be doing the same thing, but using some other Charset. :)
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascript -
Hello everybody in this forum when i encode non ascii characters in post method in http using HTTPUtility.URLEncode in C# it gives me an output of encoded string but when i encode the same word in php using urlencode function it gives me a different output in php it is almost the half encoded string from the one from C# output. the word that is encoded is : السلام عليكم in C# ====== %d8%a7%d9%84%d8%b3%d9%84%d8%a7%d9%85+%d8%b9%d9%84%d9%8a%d9%83%d9%85 in php : ======== %C7%E1%D3%E1%C7%E3%20%DA%E1%ED%DF%E3 Almost the half string in php output i need to output in C# the same encoded string as the output from php i don't know how to make it
Human knowledge belongs to the world.
-
Hello everybody in this forum when i encode non ascii characters in post method in http using HTTPUtility.URLEncode in C# it gives me an output of encoded string but when i encode the same word in php using urlencode function it gives me a different output in php it is almost the half encoded string from the one from C# output. the word that is encoded is : السلام عليكم in C# ====== %d8%a7%d9%84%d8%b3%d9%84%d8%a7%d9%85+%d8%b9%d9%84%d9%8a%d9%83%d9%85 in php : ======== %C7%E1%D3%E1%C7%E3%20%DA%E1%ED%DF%E3 Almost the half string in php output i need to output in C# the same encoded string as the output from php i don't know how to make it
Human knowledge belongs to the world.
Your C# string has 12 bytes, a plus, and 10 bytes. Your PHP string has 6 bytes, a space, and 5 bytes. Hence in PHP you're using a special character set, capable of representing all required chars as a single byte; whereas in C# you're using two bytes per char. Suggestion: find out what the character set ("codepage") is you need, then use new Encoding(codepage) and its GetBytes() method. :)
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages