UTF8 in JavaScript with a new trick

Previously I had implemented UTF8 Conversion methods in javascript that you can find it here.
Now I have Just found a new simple way for UTF8 encoding/decoding in JavaScript that seems works well in all the browsers.

function UTF8Encode(str) {
	return unescape(encodeURIComponent(str));
}
 
function UTF8Decode(str) {
	return decodeURIComponent(escape(str));
}

Comments

Blog (in persian)

سلام
برادر اگر من فارسی زبان باشم از کجابفهمم منظور شما از
Blog (in persian)
زبان پارسی است
موفق باشید
ارادتمند

RE: Blog (in persian)

سلام
اینو واسه این نوشتنم که انگلیسی زبان هایی که فارسی بلد نیستند کلیک نکنند.

دستت درد نکنه

سلام
دستت درد نکنه این کدی که گزاشتی خیلی کمک کرد
مرسی

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.