Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Character encoding changes after window.open()

The site from where I'm calling the window.open() function is in UTF-8, using the <meta> tag, everything works well, but once I call the function and open another window with the same tag, the new window shows weird characters even thought in page info it shows that the encoding stays the same (UTF-8).

This is the same problem as mine: http://bytes.com/topic/javascript/answers/622922-character-encoding-after-window-open

like image 832
LuRsT Avatar asked Jan 26 '10 15:01

LuRsT


People also ask

What is the difference between UTF-8 and Windows 1252 encoding?

Windows-1252 is a subset of UTF-8 in terms of 'what characters are available', but not in terms of their byte-by-byte representation. Windows-1252 has characters between bytes 127 and 255 that UTF-8 has a different encoding for. Any visible character in the ASCII range (127 and below) are encoded 1:1 in UTF-8.

Is UTF-8 the default encoding?

UTF-8 is the dominant encoding for the World Wide Web (and internet technologies), accounting for 98% of all web pages, and up to 100.0% for some languages, as of 2022.

Why did UTF-8 replace the ASCII character standard?

Why did UTF-8 replace the ASCII character-encoding standard? UTF-8 can store a character in more than one byte. UTF-8 replaced the ASCII character-encoding standard because it can store a character in more than a single byte. This allowed us to represent a lot more character types, like emoji.

What character encoding does Windows use?

The character set most commonly used in computers today is Unicode, a global standard for character encoding. Internally, Windows applications use the UTF-16 implementation of Unicode. In UTF-16, most characters are identified by two-byte codes.


1 Answers

I had the same problem. Just use unescape(decodeURIComponent( YOUR_URL )) inside window.open().

For example: window.open(unescape(decodeURIComponent( YOUR_URL )), '_blank');

Hope it helps.

like image 168
BetaFlasher Avatar answered Nov 10 '22 18:11

BetaFlasher