Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Ok, I do not know if this is a programming question, but it certainly is a technical one so I am asking it here. I was working on some internationalization stuff in my PHP code, and in order to ensure that my generated HTML shows up Unicode correctly based on the encoding and stuff I decided to add some Chinese text to my PHP page, which then echoes it into the browser to complete my test case.

So I went into google and typed "Chinese", copied the first Chinese text that the search returned (which was 汉语/漢語). I then copied it into Notepad++ which is my editor, and to my surprise showed up as boxes similar to [][]/[][]. So I thought the encoding in Notepad++ was messed up and I changed the encoding to UTF-8 and UCS, neither worked. I did it fresh in a newly encoded file, still I got the boxes. The same content when I paste into Google and StackOverFlow (like I did in this posting) shows up correct Chinese!

I even opened up Windows Clipboard Viewer and the content is represented in the Clipboard as boxes! I tried pasting it into Windows Explorer address bar and using to rename a file to, but I still get boxes. But it shows up correctly when pasted into my Chrome Browser address bar!

Is this a Windows issue? Since I am able to paste it correctly in SO, the data in memory should be encoded correctly right? But if that is the case why does it show up as boxes in the Clipboard Viewer?

I am confused here...By the way I am using Windows XP with SP3.

(I am asking this question here, even if it is not programmatic, because it is preventing me from running my programming test cases..)

share|improve this question

migrated from stackoverflow.com Oct 6 '12 at 21:13

This question came from our site for professional and enthusiast programmers.

2 Answers 2

up vote 0 down vote accepted

The reason why Notepad++ does not show the characters right is probably because the document encoding was “ANSI”. Since Chinese characters are not representable in “ANSI”, they were munged. Notepad++ works oddly with encodings. But the simple solution is to set, via its menus, the encoding to UTF-8 before pasting anything.

In other contexts, display of Chinese characters may fail because the rendering uses a font that does not contain them. There is great variation here. Many programs can fall back to other fonts if the primary font does not contain some character that appears in the text.

share|improve this answer
    
Even though the issue is not fixed, your answer does make sense...thank you. I had to fix it by creating a form and copy pasting the characters into it and then printing it out. –  open_sourse Oct 4 '12 at 19:10
    
That should be it. I often have this issue with Notepad++. After changing the encoding from ANSI to UTF-8, you have to RE-COPY the text - just re-pasting is not enough. –  Sprachprofi Oct 5 '12 at 8:35

With an English copy of Windows XP, you have to explicitly tell Windows you want additional support for more complex scripts. I don't have an XP box in front of me, but try starting in Control Panel -> Regional Settings, and look for options to install international text support. You may need your original installation media.

This step will install additional fonts and tables that Windows needs. You see it working on web pages because browsers of the XP era tended to do a bunch of the work themselves. Most other apps expect Windows to do all the font linking and font fallback work, and Windows XP doesn't install all that support by default.

I believe newer versions of Windows, like Vista and 7 install all the fonts and tables by default.

share|improve this answer
    
Thank you for the suggestion Adrian - I will surely check it out! –  open_sourse Oct 4 '12 at 20:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.