I used PSPad with CP1250 charset and now i switch to Aptana Studio 3 and I have problem with encoding. Is it possible to add new charset to Aptana? Because, in Aptana are charsets UTF-8, UTF-16 and ISO-8859-1 but no one works.
(Sorry for bad English)
You can set the encoding for your project under Project > Properties > Resource > Text File Encoding. There is an option to inherit from container, or to select from a dropdown (you can also type a new encoding type into this box).
Possible duplicate of this question.
Related
We're in the process of standardizing on UTF-8 encoding for all source files, to make it easier for developers using a plethora of tools (notably including IntelliJ IDEA on Windows, Mac and Linux) to handle Git merge conflicts without introducing unwanted encoding changes.
While Delphi 11 seems able to handle both UTF-8 and ANSI encoded PAS and DFM files well, and has a configuration setting (under Tools > Options > Editor) called "Default file encoding", which can be changed from its default setting of ANSI to UTF8, making all newly created PAS files be saved with UTF-8 encoding, this does not seem to affect DFM files.
DFM files seem to always get saved as ANSI. This seems to apply also to DFM files that originally were in UTF-8 encoding: when I edit them in Delphi and re-save, they get changed to ANSI.
Is this a feature or a bug? If it is a feature, could you point to some authoritative documentation stating that.
DFM files use their own proprietary encoding (# followed by number of Unicode code point) to store non-ASCII characters in string values.
However, in newer versions of Delphi, DFM files in text form may be automatically stored using UTF-8 if identifiers (class, property or component names) contain non-ASCII characters.
From the documentation for Delphi 11 Alexandria:
Component streaming (Text DFM files):
Are fully backward-compatible.
Stream as UTF-8 only if component type, property, or name contains non-ASCII-7 characters.
String property values are still streamed in “#” escaped format.
May allow values as UTF-8 as well (open issue).
Only change in binary format is potential for UTF-8 data for component name, properties, and type name.
What the Windows 'hosts' file encoding is? Is it UTF-8? Or ASCII + system codepage? How IDN (international domain names with umlauts etc.) entries should be added and can they be added at all?
It should be ANSI or UTF-8 without BOM. I just dealt with a server that had the hosts file encoding set to UCS-2 Little Endian, and that led to the file being ignored.
There is a wealth of information here:
https://serverfault.com/questions/452268/hosts-file-ignored-how-to-troubleshoot
The simple answer is
ANSI or UTF-8 WITH BOM.
(UTF-8 without BOM is NOT valid).
Details:
As far as I have tried, the encoding of the hosts file on Windows should be
ANSI or UTF-8 with BOM.
I know this question is many years old, but a colleague made the mistake of looking at this post and the ServerFault post, so I decided to add an answer.
1. Simple case only ASCII
Works.
Without any multi-byte characters, This is equivalent to ANSI, also equivalent to UTF-8 without BOM.
2. ANSI (with Japanese ANSI multi-byte characters)
Works.
note: There are Japanese characters but this is valid ANSI encoding in windows.
In Japanese editions of Windows, this code page cp932 is referred to as "ANSI",
https://en.wikipedia.org/wiki/Code_page_932_(Microsoft_Windows)
3. UTF-8 with BOM
Works.
note: BOM 付き means with BOM.
4. UTF-8 without BOM
DOES NOT work.
5. Additional test cases
If you use emoji instead of Japanese, the result will be the same.
Use emoji and save as UTF8 without BOM does not work.
(However, other lines not include emoji may be worked correctly.)
Use emoji and save as UTF8 with BOM can resolve host correctly.
note: If you use Notepad to check it yourself, be sure to put double quotes in the file name when you save it, or Notepad will be create hosts.txt.
Appended:
(Asked in comment)
The hosts file supports inline comments.
I have FreeMarker being used on an application running on Windows 7 in a Chinese locale.
The .ftl file includes this XML:
<run fontname='Arial'>Æ
</run>
The text is the letter Æ (the grapheme of AE, U+00C6) followed by an encoded newline. There is no FreeMarker text substitution on this line.
After FreeMarker text substitution is run on the file, the XML is changed, losing the ampersand:
<run fontname='Arial'>Æ#10;</run>
Without the ampersand, the encoded newline is lost, and the text "#10;" is displayed instead.
This isn't happening in other Windows systems running with other locales (English, French, German, and most notably Japanese). How can I avoid this, or is this a bug?
Looks like the result of some kind of charset disagreement. Ensure that FreeMarker uses the same charset for decoding the template file as the charset actually used for it. (For XML that's usually UTF-8.) If you don't configure FreeMarker to use a specific charset, by default it uses the default charset of the OS, which not what you want usually. Assuming your files are usually in UTF-8, you need to set the default_encoding setting (Configuration.setDefaultEncoding) to utf-8. You can also force the template charset by starting it with <#ftl encoding="utf-8">.
Currently I am trying to set application name using
net.rim.blackberry.api.homescreen.HomeScreen.setName("これはある");
but it throws exception: IllegalArgumentException.
Can anyone provide the solution?
I am using Blackberry JDE 5.0.
This is probably a string encoding problem. Try
new String(new String("これはある").getBytes("UTF-16BE"), "UTF-16BE");
It's not pretty but I think that will work.
Here's a link to the Blackberry string spec: http://www.blackberry.com/developers/docs/5.0.0api/java/lang/String.html
By default it's ISO-8859-1 which does not include Japanese characters.
The problem you are facing is how to get a string represented in your source code into your application with the same characters. For latin characters, this is pretty straightforward, as we can just put the characters in quotes, and get a string, like "Hello world"
When you go to non-latin, like Japanese, it gets harder. You can still directly write Japanese in your source code, but you need to make sure your editor and your compiler agree on an encoding so that the characters can be interpreted correctly. The Java-SE compiler takes an argument "-encoding" which allows you to specify the encoding of your java source files.
Unfortunately, rapc, the BlackBerry compiler, does not offer an option to specify encoding, even though it is invoking javac itself. So rapc uses the platform default, which is utf-8 on Linux and OSX and iso-8859-1 on Windows.
The way around this problem is to use a feature of the Java language for parsing strings - unicode escaping. By entering the six character sequence "\u3053" in a string, the java compiler will parse that number as hexidecimal and use the corresponding unicode code point, solving problems with source file encoding.
So "Hello world" and "\u0048\u0065\u006c\u006c\u006f\u0020\u0057\u006f\u0072\u006c\u0064" will result in the same strings appearing in your class files.
Because of this, Svetlin's answer from the comments is the right approach here:
net.rim.blackberry.api.homescreen.HomeScreen.setName("\u3053\u308C\u306F\u3042\u308B");
Update-edit: Here is the requested information.
Used both Rubymine 3.2.4 and the EAP version (113.2).
JRuby: 1.6.6-p357
Windows 7 64 bit
I've double checked the UTF8 config, in the IDE: File -> Settings -> General, and in the file located in ....RubyMine40\config\options\encoding.xml, both are set to UTF-8.
I have tried to set #encoding: utf-8 in my .feature file, but it still shows my special chars (æøå) as ?. Actually, it won't even run the test if I use these characters in the code under
Feature: This is some test # Feature = Egenskap in norwegian
I opened the .feature file that I created in RubyMine 4.0 (EAP) in Notepad++, and it says its coded in ANSI as UTF-8.
The question
I have a problem with special characters, in my case, æ ø å. I use RubymMine to develop cucumber tests. My IDE encoding is set to use UTF-8.
The problem is, that when I run the tests in my RubyMine, the console simply replace my special chars (æøå) with ?, which is annoying, and this also happens when I do a HTML export of the tests. I can write the .feature files in my langauge no problem,using #language: no comment at the top of feature file. It only gets messy when Rubymine outputs to console, and export the results.
Has anyone had a similar problem and knows how to solve it? Or can just point me in the right direction?