when i perform a urlencode into an Arabic string , it become unreadable,I intend to use it for urls
<?php$x='كلام عربي'; //Arabic wordecho urlencode($x); //%DF%E1%C7%E3+%DA%D1%C8%EDecho rawurlencode($x); //%DF%E1%C7%E3%20%DA%D1%C8%ED?>
I want to keep it readable , i.e : كلام+عربي
According to several Q&As on SO you're supposed to uri encode anything not ascii and of course several punctuation characters like
& in query string values and keys.
And yet AFAIK not uri encoding works just fine.
works as far as I can tell
The reason I ask is I'm using query strings to do some very simple localization of diagrams. A typical interactive diagram might have 1-5 strings, someone localizing an article that uses the diagram can do something like
bla bla bla bla see the following diagram<iframe src="diagram.html?caption=localized%20string"></iframein the diagram above bla bla bla ....
It's much easier for writers and editors to be able to create, edit and correct non-encoded urls
is much easier than
Regardless of any "standards", if there are no consequences I'd prefer to leave the URLs as un-encoded as possible to make them easier to edit. For example this Q&A says you should encode them but as far as I can tell the example above works in IE, Edge, Chrome, Firefox, Safari, Opera.
I get that I could convert them in some kind of build step. That's beside the point though. If there are no consequences of not encoding them then I will choose to not encode them.
Also, this isn't about interfacing with random other websites or servers. It's my website, my server. I don't care if so-and-so server doesn't handle this case. In fact for my purposes the query string is only used by the client.
Looking at the headers it appears all browsers encode it when making the request from the server so that's seems to suggest it's fine.
So what would be the consequences of not uri encoding non-ascii utf-8 in query string keys and values?
When I use escape/encodeURI/encodeURIComponent to encode URI,
it's encoding special characters (like "? [ ] &" ), and all non-ASCII characters.
I prefer the link to look like:
Salvete! I have discovered that a certain way of url encoding breaks the link. For the record
%2f represents the forward slash character:
Now, consider this:Original Link:
encodeURIComponent) urlencoded link:
Now, if you paste the encoded link into your browser's address bar, it is broken (Firefox, Chrome, IE).
However, if you don't url-encode the first forward slash, it works perfectly:'
This is my url .my problem is address not appending to urlpath . plz help me
var address:stringaddress = "American Tourister, Abids Road, Bogulkunta, Hyderabad, Andhra Pradesh, India"let urlpath = NSString(format: "http://maps.googleapis.com/maps/api/geocode/json?address="+"\(address)")