Chinese characters showing as blank boxes in strings.xml - utf-8

I am trying to cut and paste traditional Chinese characters as alternative resources in my values-zh-rTW/strings.xml file. They show as blank white boxes. As far as I can find, every encoding option is set to UTF-8. If it is a font issue, I'm not sure where to change the font or which font to change. I did go to General>Appearance>Colors and Fonts, but I'm not sure which font to adjust, if any. Please help if you've dealt with this before.

You might take a look at this question to make sure you're doing everything mentioned here:
How to support UTF-8 encoding in Eclipse
Here's another question that may have what you need:
How to print [Simplified] Chinese characters to Eclipse console?

I had the same problem and the solution was to install "East Asian Languages" in windows. Just go to control panel, Regional and Language Options, Languages tab, and then check Install files for East Asian languages (it required a windows cd for me).

There are some chinese characters in my eclipse editor. And it's not displayed correctly.
I change the project's text file coding by Cmd + I to show the project's Properties setting dialog. then in in put GBK in Text file encoding. then Apply it. the characters displayed correctly.
The screenshot is as below:

Related

How to show ascii non-printable characters in Visual Studio Code?

I'm using Visual Studio Code version 1.51.1 and am wondering if there is any way to display all of the ascii non-printable characters when looking at a file. I used to use Notepad++ and it had a feature you could turn on that would show every character in a file including non-printable characters.
For example, here's a screenshot from a file open in Notepad++ that I've inserted the non-printable BEL character in by pressing ALT + 007. You can also see the carriage-return/line feeds at the end of the line:
Here's a list of the characters I'm referring to (I found this list here):
So what I'm asking is there an extension I can install into Visual Studio Code or a setting that I can configure that will show all ascii characters, both printable and non-printable, similar to how Notepad++ does it as shown in the screenshot I provided? Thanks in advance.
On the bottom-right corner of the status bar, you will see the encoding of the file. Click and select “Reopen with Encoding…” and change to something like UTF-8 or higher.
You can also search for the “Change File Encoding” task via Cmd+Shift+P.

Removing Unicode character in Xcode

I often use OneNote for sample/template code which I can refer for any project. But When I copy from OneNote to Xcode I get below warning "Treating Unicode character as whitespace".
Though this is just a warning I like to see my code editor window warnings free. Is there any way to replace these Unicode character?
That happens to me, even converting the unicode text format didn't resolve this issue.
For a (hacky) solution, paste your code in apple-mail new message first, then copy and paste to Xcode, will correct this issue.

Source encoding in Visual Web Developer 2008 Express

Where can I set it? I need files to be encoded in UTF-8 by default... there is nothing in Tools -> Options or any other menu as far as I know :(
P.S. I don't need to set default encoding for Project or so, I need it to be default for any files I create. Thanks for your help :)
Instead of clicking save click save as. Then click the little down arrow by save to save with encoding. Once this is done it will bring you to the advanced save options which appear in full VS studio. You can then pick UTF-8 as the encoding.
The encoding options are available from a drop down list attached to the Save button when you select Save as..
File -> Advanced save options
Choose Encoding and Line endings
Regards,
Haris
I believe you cannot set the source encoding as a project setting. Instead, it tries to determine the source encoding from the file, using a fairly limited algorithm. Part of that algorithm is
if it has an UTF-8 signature (BOM), it is UTF-8 encoded
otherwise, it is in the ANSI system code page (CP_ACP)
There might be some additional checks in-between (e.g. checking for UTF-16 with BOM also).
In my experience, the "save as" encoding is not very useful, unless saving as UTF-8-with-BOM. You can save it in a different encoding, but in reopening, it will still assume it's CP_ACP.
IIRC, source files in visual studio are already encoded as UTF-8.
However, if I'm wrong or if you just want to force any specific coding, you can do it by choosing the Save As... option for the file and checking the pull down options under the save button from there.
Thank you for your answers but that's not exactly what I need.
Ok I will try to be more specific. That's how it goes: I go to Open website, I open website directly via FTP. On the right hand side I can see file list. I right-click on it, choose new item, html file, I have new html file. I add some text into it, click save (CTRL+S), the file is saved. Now I open it via browser and I see it's not saved in UTF-8. So, can I fix this problem in any way? :)
are you saying that even though the source file is encoded in utf-8, your internet browser is displaying it as ansi? do you have a meta encoding tag defined?
http://tlt.its.psu.edu/suggestions/international/web/tips/declare.html
try this and your browser should say it is utf-8. just saving a file in utf-8 won't do it.

Displaying Japanese fonts in source code using Visual Studio

I have some source files that have comments written in Japanese. When I open these files in Visual Studio they appear like this:
à–¾FNCAP‰¹—p‚̃XƒŒƒbƒh
I am using the English version of WinXP, but is there a way to get Visual Studio to display the actual Japanese characters rather than the random jibberish it currently is?
I found a general solution to the problem. This worked for me in Chinese text for Visual Studio 2013 and Windows 8.1.
per https://msdn.microsoft.com/en-us/library/ms246590.aspx
As Administrator Click Start, click Control Panel, and then open Regional and Language Options (or Region in Windows 8).
Click the Advanced tab. (or Administrative in Windows 8)
In the Select a language to match the language version of the non-Unicode programs you want to use list, select the language you are currently using.
Click OK.
Presumably VS is interpreting the file with the wrong encoding.
Reopen it using "File -> Open -> File... -> Open -> Open With... -> Source Code (Text) Editor With Encoding" and try various encodings.
Have you turned on support for Eastern languages for Windows? I have that turned on and I can see Chinese characters in Visual Studio 2005 on WinXP.
To turn it on you'll probably need the installation DVD for Windows. The setting is under Regional and Language Options in the Control Panel. I think you just need to check the "Install files for East Asian languages" option.
Microsoft's support page for internationalization has some screenshots and instructions.
I faced the same issue and have found a solution that works for me.
The problem is that the files aren't unicode and VS is trying to open them with an encoding that matches your location. Luckily, you can set Windows default behavior for non-unicode files. Check out this link, http://msdn.microsoft.com/en-us/library/ms246590.aspx. Look under "To correctly display characters that are not included in the current code page."
These directions are incorrect for Windows 8 (I can't speak for 7 or older.) For Windows 8:
Navigate to Control Panel
Select Clock, Language, and Region (yeah they still have the comma before and)
Region
Administrative
Change System Locale...
Select the desired language from the "Current System Locale" drop down
Most of your programs should continue to function in English as this setting is only applied when programs and files don't support unicode.
i have just gotten this problem and fixed it by changing config "files.encoding" in file "setting.json" . Go to Menu => File => Reference => setting to open the file. Search for "files.encoding" and change value to Encoding of your file (my file encoded in Shift-JIS , i checked ending by using Notpad++)
Windows 10 : --> Control Panel\Clock and Region\Region
You can also convert the text encoding to UTF-8 using Notepad++.
Originally encoded as Shift-JIS:
Convert to UTF-8:
Save file.
It should now display correctly regardless of local region.

How to modify the style property of a font on Windows?

Note that this question continues from Is it possible to coax Visual Studio 2008 into using italics for comments?
If the long question title got you, here's the problem:
How to convert the style property of the Consolas Italic font to Bold without actually modifying any of its actual glyphs? That is, we want the font to be still the same (i.e., Italic) we merely want the OS to believe that it's now a Bold font.
Please just don't mention the name of a tool (Ex: fontforge), but describe the steps to achieve this or point to such a description.
Alright, I've successfully used FontForge to create a copy of Consolas (although this should work with any font) with the bold style actually being italics.
These are the steps that I followed:
Install FontForge. It's a lot easier to do this on linux than on windows/cygwin. I used a Ubuntu VM ("sudo apt-get install fontforge").
Open Consola.ttf (the "normal" style font) in FontForge.
Select Element -> Font Info.
Change the Fontname, Family Name, and Name for Humans, all to the same thing. I used 'ConsolasVS'.
Click Ok. Click 'Yes' to let FontForge generate a new GUID for the font.
Select File -> Generate Fonts. Make sure you've got "TrueType" selected. Uncheck "Validate before saving". Click Save.
Now open Consolai.ttf (the italic style font) in FontForge.
Go back to Element -> Font Info.
Change the Font names as before, and where it currently says "Italic", change that to "Bold".
Go to the OS/2 tab, change the font weight to "700 Bold".
Go to the Mac tab, change the style set to Bold.
Click Ok. Allow a new GUID to be generated again.
File -> Generate Fonts, as before.
Copy your two new ttf files into your \Windows\FONTS\ folder.
You can now have nice italic comments with Consolas in VS2008. Hooray!
I did the italics-as-bold trick on Consolas back in July 2007 and posted a screenshot of it on my blog.
I used FontLab which does a great job but a custom tool to copy and set the header would be the best bet as you can't modify and redistribute Consolas and FontLab costs $699.
If you want to go down the FontLab route the open up the regular and italic versions and go into the File > Font Info... menu option and use the Names and Copyright section.
In there set them both fonts Family Name to a new name then flip the checkboxes on the italic version to indicate bold instead of italic and select Normal from the Weight list box and Italic in the Style Name list box.
Save and install :)

Resources