When I'm trying to print Russian text in console I get �����, despite the fact I set File Encoding and IDE Encoding to UTF-8. This problem have appeared only after updating PyCharm to 5.
Here's the pic of Typing Russian text
If in Windows or Linux add the following lines at the end of the file (Windows)PYCHARM_HOME/bin/pycharm.exe.vmoptions, (Linux)PYCHARM_HOME/bin/pycharm.vmoptions:
-Dconsole.encoding=UTF-8
-Dfile.encoding=UTF-8
In OS X Open Info.plist located in /Applications/RubyMine.app/Contents, locate the tag <key>VMOptions</key>, and modify it as follows:
<key>VMOptions</key>
<string>-Xms16m -Xmx512m -XX:MaxPermSize=120m
-Xbootclasspath/p:../lib/boot.jar -ea
-Dconsole.encoding=UTF-8
-Dfile.encoding=UTF-8
</string>
Taken from Configuring Output Encoding and Why unicode string is not shown on PyCharm's console?
Try this: go Settings -> Editor -> File Encodings and set Project Encoding to System Default (It was windows-1251 encoding in my case). It works for me.
Related
Now I download Apache NetBeans 11 and after that, I CLONE my Git PHP Repository to Windows Folder, If I open HTML files via Notepad, everything is ok, but when I open it via NetBeans, I got wrong characters interpretation like this:
BAD
Ăšvod
RIGHT
Úvod
How can I solve it to use UTF8? When I open a file in example via PSPad Editor I see the encoding is UTF8, but the format is UNIX, not DOS, maybe this cause a problem
Edit:
When I use Netbeans 8.2 Characters are ok
Any sugestions?
How do I display emojis (UTF-8) when I open a file using the nano editor? I can only see blank spaces where they should be appearing. When
I read in ubuntu thread a proposed solution saying you should check the character encoding of your terminal but when I try it I only see the 'UTF-8' and 'Default UTF-8' options. But I don't think this solves anything for I can see emojis being printed on terminal's screen when I concatenate the file.
Funnily enough, when I use multitail to see the same file in real-time, again from terminal, I see garbage instead of emojis.
My environment variables:
LANGUAGE=en_GB:en
LAN (none)
LC_ALL (none)
Is there any solution to this? Thanks!
I'm using Debian Wheezy.
My Rest-Application delivers data in correct encoding when running under Eclipse. But when I start the application as executable jar on a Windows System, my special characters are broken.
What am I missing?
Eclipse
Eclipse's encoding is set in preferences->general->workspace, which whould by default be inherited from the OS (cp1250 on windows).
When you create a "Run as" task, it also stores it. So if you update eclipse's setting, make sure you re-create your "run as" task. You can see the actual value used when launching your application: Run configurations... -> Your Run task -> Common tab.
You can also force an encoding in eclipse.ini by adding -Dfile.encoding=AnotherEncoding at the end.
Command line
When launching from the command line, it takes the system default value, which would be cp1250 on whidows.
You could print the encoding at the very first line of your program, just to see: System.out.println(System.getProperty("file.encoding"));
To specify an encoding from the command line: java -Dfile.encoding=UTF-8 yourApp.jar
See also
Take a look at this too: https://stackoverflow.com/a/14867904/641627
This indicates a problem with your code. Your code is currently
depending on the default platform encoding, and doesn't work if that
encoding is not "UTF-8". therefore, you should change the places in
your code which depend on the default platform encoding to use the
"UTF-8" encoding explicitly.
In Eclipse Luna (4.0.4) / Python 3.4.1 I can't get the PyDev 3.6.0 console to work with Unicode despite having tried several recommended corrective steps.
I attempted this example in Dive Into Python 3: http://www.diveintopython3.net/files.html
If I do the example's a_file.read(), the PyDev console displays:
'Dive Into Python \u662f\u4e3a\u6709\u7ecf\u9a8c......' instead of 'Dive Into Python 是为有经验的程序员编写的一本...'
If I paste the Chinese characters into the PyDev console ala cstring = '是为有经验的程序员编写的一本', then in the console type "cstring ENTER', I again get '\u662f\u4e3a\u6709\u7ecf\u9a8c...'
If I then try print(cstring), I get the following error:
Traceback (most recent call last):
File "", line 1, in
File "C:\Python34\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-13: character maps to
I don't know what do do with that information. The cp1252.py bit is at the heart of my confusion because I've told Eclipse and PyDev to use UTF-8 in every place I can find to do that, beginning with the information in the following:
Printing Unicode in eclipse Pydev console and in Idle
However, I cannot modify "site.py" as described in those steps because [EclipseInstallDir]/lib/site.py does not contain "encoding = ".
I can't figure out what to do next.
For regular runs:
The problem there is that the PYTHONIOENCODING is overridden by PyDev based on the encoding you used in the run configuration (which is the encoding used by the console view too -- so, it'd make no sense having a PYTHONIOENCODING with a value and the allocated console in the PyDev side with another value).
You can change the encoding you're using for a run configuration in:
Run > Run configurations > common > encoding.
By default it'll use the encoding of the file being launched (you can change the default encoding for the workspace in general > workspace > text file encoding).
For interactive console runs:
For interactive console runs there's currently no API to change the encoding in the java side, so, one has to start Eclipse itself in a VM that uses UTF-8 by default... In practice, this means that you have to add:
-Dfile.encoding=UTF-8
to the vmargs of Eclipse in eclipse.ini (and in this case it's also recommended to set the PYTHONIOENCODING environment variable in the related interpreter and set it to UTF-8).
Found it! (At least for Python 3.4.1, Eclipse Luna 4.0.4, PyDev 3.6.0.)
In Eclipse, in Preferences —> PyDev —> Interpreters —> Python Interpreter, in the Environment tab, I added the environment variable PYTHONIOENCODING and specified its value as utf-8.
The PyDev Interactive Console now properly displays the aforementioned Chinese characters (and Thai characters, too).
In my java project, I need to use Arabic text and strings, but the text becomes like "???????" , so what wrong ? and how to resolve this problem?
thanks
You can setup your Netbeans with startup option
place it inside netbeans.conf into netbeans_default_options
-J-Dfile.encoding=UTF-8
In the end it should look like
netbeans_default_options="..... -J-Dfile.encoding=UTF-8"
Hope it'll help you
Here are instructions for setting the default character set in Netbeans to UTF-8 (in Windows):
1 Go to C:\Program Files\netbeans-x.x\etc
2 Open netbeans.conf in Notepad.
3 On the netbeans_default_options add: -J-Dfile.encoding=UTF-8. (make sure to put it within the quotation marks)
4 Project properties -> Build -> Compiling ->
Additional compiler options) text box.- add: -encoding UTF-8
5 You can also check to make sure that you have increased the memory allocation for Netbeans by looking at the netbeans_default_options line. The default max is 128MB. We have increased this to 256MB.
Ubuntu go directory
ex.
sudo gedit /usr/local/netbeans-8.0/etc/netbeans.conf
Add
netbeans_default_options="-J-Dfile.encoding=UTF-8"
Save Fin
Please follow the bellow issue to solve the how to UTF 8 Dari, Pashto, Persian and Arabic Support in Netbeans
open the C:\Program Files\NetBeans 8.0.2\etc PAT form windows
than copy the netbeans.conf into your some place in your computer
add the -J-Dfile.encoding=UTF-8 inside netbeans_default_options=
like bellow code
netbeans_default_options="-J-Dfile.encoding=UTF-8 -J-client -J-Xss2m -J-Xms32m -J- XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true"
than replace the file into C:\Program Files\NetBeans 8.0.2\etc
now close the netbeans and reopen it, so it work all language like Dari, Pashto, Persian, Arabic and etc...