2

Here is an example:

PHP:

<?php
echo "ção";
?>

Git Bash:

$ php a.php
ção

Note: I'm writing a text-console application for Windows.

user182917
  • 1,688
  • 2
  • 14
  • 17
  • 6
    character sets. your terminal is probably set to a diff charset than whatever charset those chars were written into the file as. – Marc B Apr 20 '15 at 21:20
  • Could You provide source of a.php converted to HEX and encoding used by Your console? – Michas Apr 20 '15 at 21:23
  • @Michas 3c3f7068700d0a6563686f2022e7e36f223b0d0a3f3e . I'm on Git Bash, I read it's already working with UTF-8. – user182917 Apr 20 '15 at 21:31
  • @MarcB Any idea how to find out what that charset is? The terminal is of Git Bash. – user182917 Apr 20 '15 at 21:33
  • An old answer to a similar question - http://stackoverflow.com/questions/10651975/unicode-utf-8-with-git-bash - may help if you're on Windows – Mark Baker Apr 20 '15 at 21:39
  • @MarkBaker Thanks. I still don't see why it doesn't just work it it's UTF-8 compliant already. – user182917 Apr 20 '15 at 21:43
  • It looks your php file is encoded in CP-1252. Problematic letters have codes e7 and e3. These would be the 3-byte prefixes in UTF-8. I don't understand the encoding of Your Git Bash. – Michas Apr 20 '15 at 23:48
  • Is your Windows console font is Lucida? Also try with a more recent Git For Windows (https://github.com/git-for-windows/git/releases/) – VonC Apr 21 '15 at 11:27
  • @Michas I set the file as UTF-8 in Notepad++.. – user182917 Apr 22 '15 at 15:13
  • @VonC I'm on Consolas and tried other fonts. I'm in a very recent Git version.. Thanks – user182917 Apr 22 '15 at 15:18
  • @PedroSobota Is it the 2.3.5 from https://github.com/git-for-windows/git/releases/? – VonC Apr 22 '15 at 15:20
  • @Pedro-Sobota What is purpose of Your code? Do You want to write a text-console application for Windows? If so, You should edit Your question. – Michas Apr 22 '15 at 16:09
  • @VonC No, msysgit. I went ahead and uninstalled msysgit and installed git-for-windows and the problem is solved, although the Git Bash is a little different.. (I thought the official "Git" distribution for Windows was already for Windows?) Thanks – user182917 Apr 22 '15 at 17:00
  • @PedroSobota Great. I have added an answer to include this conclusion. – VonC Apr 22 '15 at 17:02
  • 1
    @PedroSobota for the difference between the two "Git for Windows", see http://stackoverflow.com/a/17810334/6309 and http://stackoverflow.com/a/784743/6309, and http://stackoverflow.com/a/3144417/6309. – VonC Apr 22 '15 at 17:05

1 Answers1

0

The bash console has changed with the more recent msys2-based (64-bits) Git For Windows 2.3.5

The OP reports:

I went ahead and uninstalled msysgit and installed git-for-windows and the problem is solved, although the Git Bash is a little different..

That more recent version of Git For Windows includes all the latest utf-8 support improvements and a bash 4.3.33 2013 (vs. a bash 3.1.20 2005)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250