Brandon
Brandon

Reputation: 1

Weird characters when I get Chinese via location.search

I am trying to send Chinese characters through URL query string but they simply turn to some weird text format: %E0%B8%81%E0%B8%B3%E0%B8%AD%E0%B8 when I get them via location.search. How to get them correctly?

Upvotes: 0

Views: 104

Answers (2)

James.Xu
James.Xu

Reputation: 8295

the text are url encoded, you should decode it first. Take a look at this page: URLDecode , select gbk to decode. There are corresponding functions in all popular languages to decode it.

Upvotes: 0

Grezzo
Grezzo

Reputation: 2263

I think your Chinese characters are being URL encoded.

Are you looking for the unescape function to decode them?

unescape("%E0%B8%81%E0%B8%B3%E0%B8%AD%E0%B8")

Upvotes: 1

Related Questions