UTF-8 in Windows 7 CMD [duplicate] - windows

This question already has answers here:
How to use unicode characters in Windows command line?
(19 answers)
Closed 6 years ago.
I've tried to display UTF-8 in the win7 cmd. Currently, I'm using the standard font because as I see with the mysql.exe, it works fine with the characters I'm working with (currently the german umlauts "ßäöüÄÖÜ"). Also, with another font, the same characters appear.
But the output of my PHP script displays garbage, e.g. 'ß' for 'ß'. When I pipe the output into a file and open it up with Notepad++, it says the encoding is UTF-8. In php.ini I set UTF-8 as the encoding as well as in the connection to the mySQL database, and in the database itself UTF-8, too.
In CMD I tried so far to set the code page to 65001, but nothing changes.
edit: my PHP script is saved as UTF-8 as well
It seems with latin1, my desired characters can be displayed too and actually it works. But there has to be a way to do it in UTF-8? I can't convert everything to latin1

This question has been already answered in Unicode characters in Windows command line - how?
You missed one step -> you need to use Lucida console fonts in addition to executing chcp 65001 from cmd console.

Related

psql cannot display german "Umlaute"

I am using psql and realized that the German letters ä, ö, ü are not displayed correctly. For example, ö is displayed as õ. ü is displayed as a three in the exponent...
WARNING: Console code page (850) differs from Windows code page
(1252) 8-bit characters might not work correctly. See psql
reference page "Notes for Windows users" for details.
How can I change that?
OS: Windows 10
psql 13.3
The table I have imported to postgres is encoded in UTF8.
I am new to postgres and psql, so sorry for the dumb question.
In the second print screen one can see that the character 'ü' in 'Eigentümer', 'Zürich' and 'Graubünden' is displayed incorrectly.
From the command line or the Terminal:
chcp 1252
open psql
psql -U postgres
set client_encoding:
SET client_encoding='WIN1252'
import file:
\i Path/to/your/.sqlFile
I had the same problem; just use
\encoding 'UTF8'

Cannot paste text in xfce4-terminal

After updating my distribution with Xfce 4.14, I am unable to copy and paste some characters into xfce4-terminal. For example, I can paste "test" but not "test α".
This is highly frustrating. I would prefer if the unknown character was replaced with a question mark, or anything really. Is there a way around this?
This was answered on SuperUser. Paraphrasing that answer:
Is the locale blank? It must be set to xxx.UTF-8 for the terminals to support non-ASCII characters. To enable Unicode support,
Add a line to /etc/locale.gen en_US.UTF-8 UTF-8
Run locale-gen
Add LANG=en_US.UTF-8 to /etc/locale.conf
Log out and log in again
The following must be set in xfce4-terminal:
preferences -> advanced -> default character encoding = UTF-8
The LANG environment variable in the shell does not matter, for example mine is set to LANG=en_US, but it's still working.

Cannot cat shift-jis file in mac terminal

I have a file that emacs correctly displays on mac. When I cat or less the file in mac terminal I see garbled characters such as "?E?u?#?#?#?#?#?#?#?". Running chardetect indicates SHIFT-JIS.
I tried adding the following to ~./bashrc but still see the same output.
export LANG=ja_JP.SHIFT_JIS
export LC_ALL=ja_JP.SHIFT_JIS
Under encodings in preferences for terminal, all encodings are checked including the Japanese ones.
Am I missing some other method here for viewing these files? I can see other files with Japanese characters in the mac terminal.
You need to change the text encoding at the Advanced tab in profile preferences to make Terminal use different encoding.
Env vars (LANG, LC_ALL) only affect the shell and child processes.
Also note that some characters from Windows cannot be displayed (①,髙,Ⅰ (roman digit) etc).

IntelliJ IDEA Terminal Special Characters

I recently started using IntelliJ IDEA Ultimate on Windows 10 and would really like to use the integrated terminal.
However, I can't get it to work with special characters like german umlauts or something like §.
That wouldn't be a problem if i hadn't some folders starting with Ü which i can't rename because they are part of a version control repo.
Because of that, i can't cd into these folders.
For example, an "ü" keystroke shows as "3R" and a "§" keystroke shows as "?" (like most special chars).
It neither works with the default terminal setting (cmd.exe) nor with git bash.
Has someone encountered a similar problem / has a solution for that?
I have had similar issues with IntelliJ Ultimate on Windows 10, regarding language and encoding on the Git Bash integrated Terminal. It was solved by setting the environment variables for the integrated terminal with the correct language. It can be done as follows:
Go to Settings
Terminal
Environment variables
Set two variables: LC_ALL=YOUR_LANGUAGE.utf8;LANG="$LC_ALL", where YOUR_LANGUAGE is the language code for the desired language. I searched a little and I think the correct one for German Umlauts is: de_DE.utf8. So, the configuration line would be:
- LC_ALL=de_DE.utf8;LANG="$LC_ALL"
Maybe you can set the file encoding by adding
-Dfile.encoding=UTF-8
to the idea64.vmoptions configuration file.

Ruby display unicode character

I'm trying to print out some Unicode characters:
# encoding: utf-8
puts "ử ậ ắ ặ ố ồ"
If I run it through Powershell, this is what I get:
If I run it through cmd, this is what I get:
If I run it in Eclipse (with Aptana Studio 3 plugin), this is what I get:
Is it a problem with my system/software or is it Ruby's problem? How can I get it to work?
It works on Ideone though: http://ideone.com/PdycKH
Ruby supports it no problem, and setting the formatting at the top of the file is the way to go.
The issue is the display via the command line window. You need to use both a font and character page that supports Unicode display.
See this question regarding doing this in the Windows command line.
About the chcp command
I figured it out:
For cmd and Powershell, I have to change the font (I changed to Consolas)
In Eclipse, I have to change the encoding: go to Run/Run configurations, select the Common tab, change the Encoding to Other: UTF-8

Resources