RubyMine and special characters, show ? when outputting results - character-encoding

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?

Related

Spooling non-ascii characters to printer

I have a program that basically creates a text report containing non-ASCII characters (Traditional Chinese, to be exact). The file opens up fine in text editors.
The main problem I'm having is printing this text report
If I print this file from notepad, the form feeds/page breaks
aren't recognized and the alignment goes haywire. Non-ASCII characters show fine.
If I use the command "type filename > \\machine\printer", the alignment works but all non-ASCII characters print as gibberish.
I've tried several variations of raw printing, setting system locale, changing code page, etc but can't get it to work.
Originally, the program was allowed to spool directly to printer (and it worked fine) but due to technology changes, direct spooling is forbidden. I can only work with the text-file as-is after it's been generated.
Does anyone have an idea how to work with this?
Found a way -basically using powershell and force the encoding to UTF-8 in Get-Content. Apparently cmd spooling will never be able to handle this...

—- " added in HTML when converting MarkDown file to HTML using Jekyll tool

I have used Jekyll tool to convert MarkDown file To HTML. It has been successfully converted to HTML. but the below following encoded punctuation characters has been added at the top of the HTML, due to the file encoded format is Encode in UTF-8.
"—-"
After changed the same markdown file to Encode in ANSI format in NotePad++[encoding option in menu bar]. The punctuation character not included in generated HTML.
In this we need to manually change the markdown file to ANSI for HTML generation 'Jekyll'.
Any solution for this?
 is the UTF-8 BOM so that's probably what you are seeing, assuming you are looking at it using CP1252; and — is something out of the General Punctuation block.
Proper diagnostics are not possible without an indication of which character encoding you are using instead of UTF-8 to view the file, and/or what exact bytes you have in the file, probably as a hex dump. The first few bytes (the BOM) would be EF BB BF. See also the character-encoding tag wiki for troubleshooting tips.
Quick googling indicates that Jekyll is highly allergic to UTF-8 BOM in its input, so it seems unlikely that it generates spurious BOM characters on output. I could speculate that the template file you are using has a BOM and that it is being faithfully included in the output, but I'm not really familiar enough with Jekyll to actually help troubleshoot any further.
Of course, as per the big ugly warnings all over the Jekyll site, I assume you have already made sure that your Markdown input doesn't have a BOM character. Many Windows editors are notorious for putting one in when you save as UTF-8; make sure you use "UTF-8 without a BOM" as the "Save As..." format -- and switch to an editor which offers this option if yours doesn't have it.
try using charset=utf-8
or
Check your content has any straight double quote (" ") or straight single quote (' ') and remove those
http://practicaltypography.com/straight-and-curly-quotes.html
This encoding format issue. make the markdown file in UTF-8 without BOM format.
This will remove the punctuation character in 'html' .

How to solve byte order mark, BOM, in localization files

My Rails app's localization works fine locally, but when deployed to Heroku some word don't get translated and renders the "missing translation" span tag.
This question seems to have the same problem and have solved it by removing the offending BOM. But what does this imply, how do I identify and remove offending BOM in my yaml-file?
Or/and what should I look for to check if BOM exists in the file?
I'm editing in Sublime.
If BOM is your problem, in Sublime you can go to File --> Save With Encoding --> UTF8.
UTF8 options is implied to be without BOM. You have other option as well UTF8 with BOM.

How to programmatically set application name in Japanese?

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\u‌​308B");

How to disable RSpec2 UTF-8 and HTML characters escaping?

WIth ruby 1.8.7 and rails 3.0.3 on Mac OS I always got "&#...;" characters in ERB template output running rspec 2.4 controllers tests (with integrate_views).
Besides "&" character and Cyrillic characters are always escaped, even using <%= raw '...' or html_safe methods.
Can anybody give a clue - what's going on here?
You mean console/terminal output?
Try editing you ~/.profile file and pasting this line:
export LANG=sr_YU.UTF-8
You can find listing of all available locales here.
Replace sr_YU with your own cyrillic locale.

Resources