How To Display "Chinese" Character Comments And Strings In Eclipse - eclipse

The android project was compiled under Windows. When I import the project in eclipse under Mac, the comments and hardcoded strings, which is supposed to be displayed in Chinese, were all displayed as garbages.
See screenshot below:
Is there a way to solve this? Please help. Many Thanks!

As you are putting text as hardcoded please input that text in the string.xml

Change file encoding. Open file in editor. Click File > Properties and change encoding. Try UTF-8 or UTF-16

Related

How to change encoding of all files at once with Jetbrains IDE like WebStorm

For some unknown reason, the encoding of my files has changed without me noticing for a while.
It was UTF-8 and now is windows-1252. I have reset the project encoding from Settings->File encoding but I can't detect which files are badly encoded and can't figure out how to reencode all files within the project at once.
I have a strong feeling that the problem appeared with WebStorm 10 first released version, but I may be wrong. (I think it's because it set by default the project encoding setting to windows-1252)
Close every project you have opened by clicking File > Close Project.
Once they are all closed, the startup window will show up (The window with the latest opened projects with the options to open new project, etc..) In that window, at the bottom right corner you have settings.
In Settings > Editor > File Encodings.You can set up all the File Encoding options to UTF-8, it will be added to the new projects from now on.
If you want it for old projects, do the same steps, but access the settings once you have the project open.
I hope this help!
To convert the file encoding, you have to use some external tool to perform the conversion, such as iconv:
iconv -f windows-1252 -t utf-8 <input file> > <output file>
You can change your code's character set in WebStorm foot bar
Open code file
You can see foot bar ( This menu is in right down. )
Click character set select bar
change your code encoding
change and save
If you have encoding defined in your files e.g. like this <meta charset="windows-1252">
you can you use Idea's Replace in Path... functionality and modify multiple files at once.
Even you don't have that definition, you may be able to add it to your files using the same search and replace functionality. I had to convert massive amount of ISO-8859-1 encoded file to UTF-8 and this solution worked fine.

How do I see the current encoding of a file in Sublime Text?

How do I see the current encoding of a file in Sublime Text?
This seems like a pretty simple thing to do but searching has not yielded much. Any pointers would be appreciated!
Since this thread is a popular result in google search, here is the way to do it for sublime text 3 build 3059+:
in user preferences, add the line:
"show_encoding": true
Another option in case you don't wanna use a plugin:
Ctrl+`
or
View -> Show Console
type on the console the following command:
view.encoding()
In case you want to something more intrusive, there's a option to create an shortcut that executes the following command:
sublime.message_dialog(view.encoding())
With the EncodingHelper plugin you can view the encoding of the file on the status bar. Also you can convert the encoding of the file and extended another functionalities.
For my part, and without any plug-in, simply saving the file either from the File menu or with keyboards shortcuts
CTRL + S (Windows, Linux) or CMD + S (Mac OS)
briefly displays the current encoding - between parentheses - in the status bar, at the bottom of the editor's window. This suggestion works in Sublime Text 2 and 3.
Note that the displayed encoding to the right in the status bar of Sublime Text 3, may display the wrong encoding of the file if you have attempted to save the file with an encoding that can't represent all the characters in your file.
In this case you would have seen an informational dialog and Sublime telling you it's falling back to UTF-8. This may not be the case, so be careful.
ShowEncoding is another simple plugin that shows you the encoding in the status bar. That's all it does, to convert between encodings use the built-in "Save with Encoding" and "Reopen with Encoding" commands.
plugin ConverToUTF8 also has the functionality.

Changing text file encoding does not effect the text

I tried to change the encoding of ANSI files (àìà ìùîåø) to UTF8.
I was manage to do that in the pass.
Now when i try to do the same thing, the encoding setting is changing but the weird character does not change and does not seems to get any effect.
I have tried with any good editors like notepad++ notepad2 notepad3 with no success.
I think that the problem is in my machine.
What could it be?
Thanks!
If you have Microsoft Office 2003 open Word copy the text and select it then go to tools -> fix broken text and choose your language. this will convert the text back to its original state

iphone sdk Localizable.strings files displaying incorrecting in xcode 4.1 after upgrading

After upgrading to iphone xcode 4.1 build 4B110F all of my localizable.strings files are showing up as gibberish in the xcode editor. I created these files using UTF-16. I can not find a way to tell the editor that they are UTF-16. I am able to view the Localizable.strings files by viewing as a property list, but if I view them as Source Code, I see gibberish. I like to translate the entire localization.strings file and paste it into the editor. I don't want to have to cut and paste one line at a time in the property editor. There should be some way to tell xcode to show the file as UTF-16. Does anyone have any ideas?
I tried removing the files and re-adding them. I used to get prompted for the UTF type, but it does not do this any more.
You can find the text encoding setting for a file in the Utility area of Xcode 4.1. The utility area is the right-handside lateral area.
In the utility area, look for and select the first pane, named "File Inspector".
There, you will find the text encoding in the "Text Settings" block. Expand if necessary using the triangle.
I had this same problem. I was able to work around it (without much actual investigation) by simply opening the previous string files in TextWrangler, then copy from TextWrangler and paste into XCode4's view of the string file. Things seem to be working fine as a result.
To fix XCode 4.1 UTF-16 encoding issues:
1: Open the file you want to change
2: Put your cursor into the file, which will give the editor focus (VERY IMPORTANT).
3: Proceed to look under the Utilities Pane (very far right) for Text Settings and use the Text Encoding drop down to select UTF-16 or whatever other encoding you want.
If you forget step 2, and only highlight the file in the Project Navigator, you will not see encoding options.

How to change text encoding of Localizable.strings file in Xcode 4?

I am learning how to localize the strings in my project and I am using Xcode 4.
I have generated the base Localizable.strings file, and I want to import this file, changing its encoding from utf-16 to Unicode utf-16 so that the text in the file is readable within xCode. If I strate import this file, when I select it within xcode, the text shows up as gibberish.
In Xcode 3 when you drag the Localizable.strings into your project, the dialog box which appears gives you the option to change the text encoding, but this is not the case in Xcode 4.
Does anyone know a way around this?
Maybe this can help you Objective C/Xcode 4: Encoding Problem with Localizable.strings files
These kind of errors can happen if you copy and paste content within Xcode or from external files in your localization files. The consequence is that the encoding of the file changes to for example Western (Mac OS Roman). The Localizable.strings file should be in UTF-16 though.
Solution
1.
Like in the picture below, navigate in Xcode to the Localizable.strings location and open it so that you can see all the languages you are supporting.
Left-click on the language file the causes the build error.
Make sure your Utilities View is showing in Xcode. Activate on the button at mark 1 in Picture below.
In the Utilities View select the File Inspector. (Small Logo that looks like Page)
Under Text Settings change the encoding to UTF-16(Marked as 2 in the picture above). The Drop-Down might be grayed out but you can click on it anyways. Click on "Convert" on the Popup.
That's it your project should now compile again.
The "Text Settings" for my Localizable.strings files don't have the option of changing the encoding like XCode 3. However, I found if I simply restart Xcode 4, it reinterprets it correctly (UTF-16).
Sometimes Xcode displays the warning, even if the file contents are UTF-16, but the file is somehow interpreted as UTF-8. iconv usually says that it can’t convert the file in this case. Converting the file in Xcode to UTF-8 and then converting it back again to UTF-16, like Edmar suggested, solves this problem. The warnings are gone.
To make sure that nothing got broken during the conversion, recheck the whole strings file.
After changing the encoding, and re-executing the genstrings command to regenerate the localize string, things should work.
View -> Utilities -> Show File Inspector
Change Text Encoding in the file inspector utility view.