threads / discuss / 38413

Git messes up 'ø' character

Subject: Git messes up 'ø' character

## tl;dr

14 messages between Jan 20, 2015 and Jan 22, 2015.

replies: 13people: 7as markdown or json

Noralf Trønnes· Jan 20, 2015, 19:46 UTC · lore

I can't get my name: Noralf Trønnes, to come out correctly when I format and send a patch. The 'ø' becomes a question mark when received in my email client.

This is the head of the patch file generated by git format-patch:
 From b2a4f6abdb097c4dc092b56995a2af8e42fbea79 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Noralf=20Tr=F8nnes?= <notro@tronnes.org>
Date: Tue, 20 Jan 2015 18:34:47 +0100
Subject: [PATCH] staging: fbtft: remove ARCH_BCM2708 optimization
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
ARCH_BCM2708 is not present in mainline so remove optimization.
Signed-off-by: Noralf Trønnes <notro@tronnes.org>
---
$ git log -1
commit b2a4f6abdb097c4dc092b56995a2af8e42fbea79
Author: Noralf Tr<F8>nnes <notro@tronnes.org>
Date:   Tue Jan 20 18:34:47 2015 +0100
     staging: fbtft: remove ARCH_BCM2708 optimization
     ARCH_BCM2708 is not present in mainline so remove optimization.
     Signed-off-by: Noralf Tr<F8>nnes <notro@tronnes.org>

$ git send-email --to notro@tronnes.org 0001-staging-fbtft-remove-ARCH_BCM2708-optimization.patch 0001-staging-fbtft-remove-ARCH_BCM2708-optimization.patch (mbox) Adding cc: =?UTF-8?q?Noralf=20Tr=F8nnes?= <notro@tronnes.org> from line 'From: =?UTF-8?q?Noralf=20Tr=F8nnes?= <notro@tronnes.org>' (body) Adding cc: Noralf Trønnes <notro@tronnes.org> from line 'Signed-off-by: Noralf Trønnes <notro@tronnes.org>'

From: =?UTF-8?q?Noralf=20Tr=F8nnes?= <notro@tronnes.org>
To: notro@tronnes.org
Subject: [PATCH] staging: fbtft: remove ARCH_BCM2708 optimization
Date: Tue, 20 Jan 2015 20:25:24 +0100
Message-Id: <1421781924-3066-1-git-send-email-notro@tronnes.org>
X-Mailer: git-send-email 2.2.2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
     The Cc list above has been expanded by additional
     addresses found in the patch commit message. By default
     send-email prompts before sending whenever this occurs.
     This behavior is controlled by the sendemail.confirm
     configuration setting.
     For additional information, run 'git send-email --help'.
     To retain the current behavior, but squelch this message,
     run 'git config --global sendemail.confirm auto'.
Send this email? ([y]es|[n]o|[q]uit|[a]ll): y
OK. Log says:
Server: smtp.ebnett.no
MAIL FROM:<notro@tronnes.org>
RCPT TO:<notro@tronnes.org>
From: =?UTF-8?q?Noralf=20Tr=F8nnes?= <notro@tronnes.org>
To: notro@tronnes.org
Subject: [PATCH] staging: fbtft: remove ARCH_BCM2708 optimization
Date: Tue, 20 Jan 2015 20:44:15 +0100
Message-Id: <1421783055-3117-1-git-send-email-notro@tronnes.org>
X-Mailer: git-send-email 2.2.2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Result: 250 2.0.0 Ok: queued as B49BB8014D
Setup:

Ubuntu server $ cat /etc/issue Ubuntu 12.04.3 LTS \n \l

$ git --version git version 2.2.2

$ git config -l user.name=Noralf Trønnes user.email=notro@tronnes.org core.editor=nano alias.serve=daemon --verbose --export-all --base-path=/home/pi --reuseaddr sendemail.smtpserver=smtp.ebnett.no core.repositoryformatversion=0 core.filemode=true core.bare=false core.logallrefupdates=true remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* remote.origin.url=git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git branch.master.remote=origin branch.master.merge=refs/heads/master branch.staging-testing.remote=origin branch.staging-testing.merge=refs/heads/staging-testing

Regards, Noralf Trønnes

Torsten Bögershausen· Jan 20, 2015, 20:07 UTC · re: Noralf Trønnes · lore

Re: Git messes up 'ø' character

On 2015-01-20 20.46, Noralf Trønnes wrote: could it be that your "ø" is not encoded as UTF-8, but in ISO-8859-15 (or so)

> $ git log -1
> commit b2a4f6abdb097c4dc092b56995a2af8e42fbea79
> Author: Noralf Tr<F8>nnes <notro@tronnes.org>

What does git config -l | grep Noralf | xxd say ?

Noralf Trønnes· Jan 20, 2015, 20:17 UTC · re: Torsten Bögershausen · lore

Re: Git messes up 'ø' character

Den 20.01.2015 21:07, skrev Torsten Bögershausen:
Show 11 quoted lines
> On 2015-01-20 20.46, Noralf Trønnes wrote:
> could it be that your "ø" is not encoded as UTF-8,
> but in ISO-8859-15 (or so)
>
>> $ git log -1
>> commit b2a4f6abdb097c4dc092b56995a2af8e42fbea79
>> Author: Noralf Tr<F8>nnes <notro@tronnes.org>
> What does
> git config -l | grep Noralf | xxd
> say ?
>

$ git config -l | grep Noralf | xxd 0000000: 7573 6572 2e6e 616d 653d 4e6f 7261 6c66 user.name=Noralf 0000010: 2054 72f8 6e6e 6573 0a Tr.nnes.

$ file ~/.gitconfig /home/pi/.gitconfig: ISO-8859 text

Ævar Arnfjörð Bjarmason· Jan 20, 2015, 20:45 UTC · re: Noralf Trønnes · lore

Re: Git messes up 'ø' character

On Tue, Jan 20, 2015 at 9:17 PM, Noralf Trønnes <notro@tronnes.org> wrote:
Show 20 quoted lines
> Den 20.01.2015 21:07, skrev Torsten Bögershausen:
>>
>> On 2015-01-20 20.46, Noralf Trønnes wrote:
>> could it be that your "ø" is not encoded as UTF-8,
>> but in ISO-8859-15 (or so)
>>
>>> $ git log -1
>>> commit b2a4f6abdb097c4dc092b56995a2af8e42fbea79
>>> Author: Noralf Tr<F8>nnes <notro@tronnes.org>
>>
>> What does
>> git config -l | grep Noralf | xxd
>> say ?
>>
> $ git config -l | grep Noralf | xxd
> 0000000: 7573 6572 2e6e 616d 653d 4e6f 7261 6c66  user.name=Noralf
> 0000010: 2054 72f8 6e6e 6573 0a                    Tr.nnes.
>
> $ file ~/.gitconfig
> /home/pi/.gitconfig: ISO-8859 text
What's happened here is that:
 1. You've authored your commit in ISO-8859-1
 2. Git itself has no place for the encoding of the author name in the
commit object format
 3. git-format-patch has a --compose-encoding which I think would sort
this out if you set it to ISO-8859-1, but it defaults to UTF-8
 4. Your patch is actually a ISO-8859-1 byte sequence, but is
advertised as UTF-8
 5. You end up with a screwed-up commit

You could work around this, but I suggest just joining the 21st century and working exclusively in UTF-8, it makes things much easier, speaking as someone with 3x more non-ASCII characters their his name than you :)

Greg Kroah-Hartman· Jan 20, 2015, 21:05 UTC · re: Ævar Arnfjörð Bjarmason · lore

Re: Git messes up 'ø' character

On Tue, Jan 20, 2015 at 09:45:46PM +0100, Ævar Arnfjörð Bjarmason wrote:
Show 37 quoted lines
> On Tue, Jan 20, 2015 at 9:17 PM, Noralf Trønnes <notro@tronnes.org> wrote:
> > Den 20.01.2015 21:07, skrev Torsten Bögershausen:
> >>
> >> On 2015-01-20 20.46, Noralf Trønnes wrote:
> >> could it be that your "ø" is not encoded as UTF-8,
> >> but in ISO-8859-15 (or so)
> >>
> >>> $ git log -1
> >>> commit b2a4f6abdb097c4dc092b56995a2af8e42fbea79
> >>> Author: Noralf Tr<F8>nnes <notro@tronnes.org>
> >>
> >> What does
> >> git config -l | grep Noralf | xxd
> >> say ?
> >>
> > $ git config -l | grep Noralf | xxd
> > 0000000: 7573 6572 2e6e 616d 653d 4e6f 7261 6c66  user.name=Noralf
> > 0000010: 2054 72f8 6e6e 6573 0a                    Tr.nnes.
> >
> > $ file ~/.gitconfig
> > /home/pi/.gitconfig: ISO-8859 text
> 
> What's happened here is that:
> 
>  1. You've authored your commit in ISO-8859-1
>  2. Git itself has no place for the encoding of the author name in the
> commit object format
>  3. git-format-patch has a --compose-encoding which I think would sort
> this out if you set it to ISO-8859-1, but it defaults to UTF-8
>  4. Your patch is actually a ISO-8859-1 byte sequence, but is
> advertised as UTF-8
>  5. You end up with a screwed-up commit
> 
> You could work around this, but I suggest just joining the 21st
> century and working exclusively in UTF-8, it makes things much easier,
> speaking as someone with 3x more non-ASCII characters their his name
> than you :)

So how exactly do you fix this using UTF-8? Git is exporting a UTF-8 "From:" line so it thinks the character is correct, but it's not creating something properly here.

confused,
greg k-h
Jeff King· Jan 20, 2015, 21:20 UTC · re: Ævar Arnfjörð Bjarmason · lore

Re: Git messes up 'ø' character

On Tue, Jan 20, 2015 at 09:45:46PM +0100, Ævar Arnfjörð Bjarmason wrote:
Show 5 quoted lines
> What's happened here is that:
> 
>  1. You've authored your commit in ISO-8859-1
>  2. Git itself has no place for the encoding of the author name in the
> commit object format

Is (2) right? The "encoding" header in a commit object should apply not just to the commit message, but also to the author (and committer) name.

I think the real problem is simply that it defaults to UTF-8, but he is giving it iso-8859-1 characters. Setting i18n.commitEncoding should fix it.

-Peff
PS If you try experimenting with this, you may fall afoul of 08a94a1
   (commit/commit-tree: correct latin1 to utf-8, 2012-06-28), which will
   silently "correct" Latin1 characters into UTF-8 (when the commit
   message is expected to be in UTF-8, of course). So it actually
   _should_ just work under modern gits, but only for Latin1.
Ævar Arnfjörð Bjarmason· Jan 20, 2015, 21:27 UTC · re: Jeff King · lore

Re: Git messes up 'ø' character

On Tue, Jan 20, 2015 at 10:20 PM, Jeff King <peff@peff.net> wrote:
Show 14 quoted lines
> On Tue, Jan 20, 2015 at 09:45:46PM +0100, Ævar Arnfjörð Bjarmason wrote:
>
>> What's happened here is that:
>>
>>  1. You've authored your commit in ISO-8859-1
>>  2. Git itself has no place for the encoding of the author name in the
>> commit object format
>
> Is (2) right? The "encoding" header in a commit object should apply not
> just to the commit message, but also to the author (and committer) name.
>
> I think the real problem is simply that it defaults to UTF-8, but he is
> giving it iso-8859-1 characters. Setting i18n.commitEncoding should fix
> it.
True, I forgot about that setting.
Show 7 quoted lines
> -Peff
>
> PS If you try experimenting with this, you may fall afoul of 08a94a1
>    (commit/commit-tree: correct latin1 to utf-8, 2012-06-28), which will
>    silently "correct" Latin1 characters into UTF-8 (when the commit
>    message is expected to be in UTF-8, of course). So it actually
>    _should_ just work under modern gits, but only for Latin1.
Noralf Trønnes· Jan 20, 2015, 21:23 UTC · re: Ævar Arnfjörð Bjarmason · lore

Re: Git messes up 'ø' character

Den 20.01.2015 21:45, skrev Ævar Arnfjörð Bjarmason:
Show 35 quoted lines
> On Tue, Jan 20, 2015 at 9:17 PM, Noralf Trønnes <notro@tronnes.org> wrote:
>> Den 20.01.2015 21:07, skrev Torsten Bögershausen:
>>> On 2015-01-20 20.46, Noralf Trønnes wrote:
>>> could it be that your "ø" is not encoded as UTF-8,
>>> but in ISO-8859-15 (or so)
>>>
>>>> $ git log -1
>>>> commit b2a4f6abdb097c4dc092b56995a2af8e42fbea79
>>>> Author: Noralf Tr<F8>nnes <notro@tronnes.org>
>>> What does
>>> git config -l | grep Noralf | xxd
>>> say ?
>>>
>> $ git config -l | grep Noralf | xxd
>> 0000000: 7573 6572 2e6e 616d 653d 4e6f 7261 6c66  user.name=Noralf
>> 0000010: 2054 72f8 6e6e 6573 0a                    Tr.nnes.
>>
>> $ file ~/.gitconfig
>> /home/pi/.gitconfig: ISO-8859 text
> What's happened here is that:
>
>   1. You've authored your commit in ISO-8859-1
>   2. Git itself has no place for the encoding of the author name in the
> commit object format
>   3. git-format-patch has a --compose-encoding which I think would sort
> this out if you set it to ISO-8859-1, but it defaults to UTF-8
>   4. Your patch is actually a ISO-8859-1 byte sequence, but is
> advertised as UTF-8
>   5. You end up with a screwed-up commit
>
> You could work around this, but I suggest just joining the 21st
> century and working exclusively in UTF-8, it makes things much easier,
> speaking as someone with 3x more non-ASCII characters their his name
> than you :)
>
Ok, then the question is: How do I switch to UTF-8?

To me it seems I'm already using it: $ locale charmap UTF-8

Ævar Arnfjörð Bjarmason· Jan 20, 2015, 21:26 UTC · re: Noralf Trønnes · lore

Re: Git messes up 'ø' character

On Tue, Jan 20, 2015 at 10:23 PM, Noralf Trønnes <notro@tronnes.org> wrote:
Show 47 quoted lines
> Den 20.01.2015 21:45, skrev Ævar Arnfjörð Bjarmason:
>
>> On Tue, Jan 20, 2015 at 9:17 PM, Noralf Trønnes <notro@tronnes.org> wrote:
>>>
>>> Den 20.01.2015 21:07, skrev Torsten Bögershausen:
>>>>
>>>> On 2015-01-20 20.46, Noralf Trønnes wrote:
>>>> could it be that your "ø" is not encoded as UTF-8,
>>>> but in ISO-8859-15 (or so)
>>>>
>>>>> $ git log -1
>>>>> commit b2a4f6abdb097c4dc092b56995a2af8e42fbea79
>>>>> Author: Noralf Tr<F8>nnes <notro@tronnes.org>
>>>>
>>>> What does
>>>> git config -l | grep Noralf | xxd
>>>> say ?
>>>>
>>> $ git config -l | grep Noralf | xxd
>>> 0000000: 7573 6572 2e6e 616d 653d 4e6f 7261 6c66  user.name=Noralf
>>> 0000010: 2054 72f8 6e6e 6573 0a                    Tr.nnes.
>>>
>>> $ file ~/.gitconfig
>>> /home/pi/.gitconfig: ISO-8859 text
>>
>> What's happened here is that:
>>
>>   1. You've authored your commit in ISO-8859-1
>>   2. Git itself has no place for the encoding of the author name in the
>> commit object format
>>   3. git-format-patch has a --compose-encoding which I think would sort
>> this out if you set it to ISO-8859-1, but it defaults to UTF-8
>>   4. Your patch is actually a ISO-8859-1 byte sequence, but is
>> advertised as UTF-8
>>   5. You end up with a screwed-up commit
>>
>> You could work around this, but I suggest just joining the 21st
>> century and working exclusively in UTF-8, it makes things much easier,
>> speaking as someone with 3x more non-ASCII characters their his name
>> than you :)
>>
>
> Ok, then the question is: How do I switch to UTF-8?
>
> To me it seems I'm already using it:
> $ locale charmap
> UTF-8
Your .gitconfig has an ISO-8859-1 string, from an earlier mail of yours:
> $ git config -l | grep Noralf | xxd
> 0000000: 7573 6572 2e6e 616d 653d 4e6f 7261 6c66  user.name=Noralf
> 0000010: 2054 72f8 6e6e 6573 0a                    Tr.nnes.
On a system configured for UTF-8 this would be:

$ echo Noralf Trønnes | xxd 0000000: 4e6f 7261 6c66 2054 72c3 b86e 6e65 730a Noralf Tr..nnes.

Note the "f8" v.s. "c3 b8".
Noralf Trønnes· Jan 20, 2015, 21:38 UTC · re: Ævar Arnfjörð Bjarmason · lore

Re: Git messes up 'ø' character

Den 20.01.2015 22:26, skrev Ævar Arnfjörð Bjarmason:
Show 55 quoted lines
> On Tue, Jan 20, 2015 at 10:23 PM, Noralf Trønnes <notro@tronnes.org> wrote:
>> Den 20.01.2015 21:45, skrev Ævar Arnfjörð Bjarmason:
>>
>>> On Tue, Jan 20, 2015 at 9:17 PM, Noralf Trønnes <notro@tronnes.org> wrote:
>>>> Den 20.01.2015 21:07, skrev Torsten Bögershausen:
>>>>> On 2015-01-20 20.46, Noralf Trønnes wrote:
>>>>> could it be that your "ø" is not encoded as UTF-8,
>>>>> but in ISO-8859-15 (or so)
>>>>>
>>>>>> $ git log -1
>>>>>> commit b2a4f6abdb097c4dc092b56995a2af8e42fbea79
>>>>>> Author: Noralf Tr<F8>nnes <notro@tronnes.org>
>>>>> What does
>>>>> git config -l | grep Noralf | xxd
>>>>> say ?
>>>>>
>>>> $ git config -l | grep Noralf | xxd
>>>> 0000000: 7573 6572 2e6e 616d 653d 4e6f 7261 6c66  user.name=Noralf
>>>> 0000010: 2054 72f8 6e6e 6573 0a                    Tr.nnes.
>>>>
>>>> $ file ~/.gitconfig
>>>> /home/pi/.gitconfig: ISO-8859 text
>>> What's happened here is that:
>>>
>>>    1. You've authored your commit in ISO-8859-1
>>>    2. Git itself has no place for the encoding of the author name in the
>>> commit object format
>>>    3. git-format-patch has a --compose-encoding which I think would sort
>>> this out if you set it to ISO-8859-1, but it defaults to UTF-8
>>>    4. Your patch is actually a ISO-8859-1 byte sequence, but is
>>> advertised as UTF-8
>>>    5. You end up with a screwed-up commit
>>>
>>> You could work around this, but I suggest just joining the 21st
>>> century and working exclusively in UTF-8, it makes things much easier,
>>> speaking as someone with 3x more non-ASCII characters their his name
>>> than you :)
>>>
>> Ok, then the question is: How do I switch to UTF-8?
>>
>> To me it seems I'm already using it:
>> $ locale charmap
>> UTF-8
> Your .gitconfig has an ISO-8859-1 string, from an earlier mail of yours:
>
>> $ git config -l | grep Noralf | xxd
>> 0000000: 7573 6572 2e6e 616d 653d 4e6f 7261 6c66  user.name=Noralf
>> 0000010: 2054 72f8 6e6e 6573 0a                    Tr.nnes.
> On a system configured for UTF-8 this would be:
>
> $ echo Noralf Trønnes | xxd
> 0000000: 4e6f 7261 6c66 2054 72c3 b86e 6e65 730a  Noralf Tr..nnes.
>
> Note the "f8" v.s. "c3 b8".
>

Yes: $ echo Noralf Trønnes | xxd 0000000: 4e6f 7261 6c66 2054 72f8 6e6e 6573 0a Noralf Tr.nnes.

Is there a command I can run that shows that I'm using ISO-8859-1 ? I need something to google with, my previous search only gave locale stuff, which seems fine.

Ævar Arnfjörð Bjarmason· Jan 20, 2015, 21:57 UTC · re: Noralf Trønnes · lore

Re: Git messes up 'ø' character

On Tue, Jan 20, 2015 at 10:38 PM, Noralf Trønnes <notro@tronnes.org> wrote:
Show 74 quoted lines
> Den 20.01.2015 22:26, skrev Ævar Arnfjörð Bjarmason:
>
>> On Tue, Jan 20, 2015 at 10:23 PM, Noralf Trønnes <notro@tronnes.org>
>> wrote:
>>>
>>> Den 20.01.2015 21:45, skrev Ævar Arnfjörð Bjarmason:
>>>
>>>> On Tue, Jan 20, 2015 at 9:17 PM, Noralf Trønnes <notro@tronnes.org>
>>>> wrote:
>>>>>
>>>>> Den 20.01.2015 21:07, skrev Torsten Bögershausen:
>>>>>>
>>>>>> On 2015-01-20 20.46, Noralf Trønnes wrote:
>>>>>> could it be that your "ø" is not encoded as UTF-8,
>>>>>> but in ISO-8859-15 (or so)
>>>>>>
>>>>>>> $ git log -1
>>>>>>> commit b2a4f6abdb097c4dc092b56995a2af8e42fbea79
>>>>>>> Author: Noralf Tr<F8>nnes <notro@tronnes.org>
>>>>>>
>>>>>> What does
>>>>>> git config -l | grep Noralf | xxd
>>>>>> say ?
>>>>>>
>>>>> $ git config -l | grep Noralf | xxd
>>>>> 0000000: 7573 6572 2e6e 616d 653d 4e6f 7261 6c66  user.name=Noralf
>>>>> 0000010: 2054 72f8 6e6e 6573 0a                    Tr.nnes.
>>>>>
>>>>> $ file ~/.gitconfig
>>>>> /home/pi/.gitconfig: ISO-8859 text
>>>>
>>>> What's happened here is that:
>>>>
>>>>    1. You've authored your commit in ISO-8859-1
>>>>    2. Git itself has no place for the encoding of the author name in the
>>>> commit object format
>>>>    3. git-format-patch has a --compose-encoding which I think would sort
>>>> this out if you set it to ISO-8859-1, but it defaults to UTF-8
>>>>    4. Your patch is actually a ISO-8859-1 byte sequence, but is
>>>> advertised as UTF-8
>>>>    5. You end up with a screwed-up commit
>>>>
>>>> You could work around this, but I suggest just joining the 21st
>>>> century and working exclusively in UTF-8, it makes things much easier,
>>>> speaking as someone with 3x more non-ASCII characters their his name
>>>> than you :)
>>>>
>>> Ok, then the question is: How do I switch to UTF-8?
>>>
>>> To me it seems I'm already using it:
>>> $ locale charmap
>>> UTF-8
>>
>> Your .gitconfig has an ISO-8859-1 string, from an earlier mail of yours:
>>
>>> $ git config -l | grep Noralf | xxd
>>> 0000000: 7573 6572 2e6e 616d 653d 4e6f 7261 6c66  user.name=Noralf
>>> 0000010: 2054 72f8 6e6e 6573 0a                    Tr.nnes.
>>
>> On a system configured for UTF-8 this would be:
>>
>> $ echo Noralf Trønnes | xxd
>> 0000000: 4e6f 7261 6c66 2054 72c3 b86e 6e65 730a  Noralf Tr..nnes.
>>
>> Note the "f8" v.s. "c3 b8".
>>
>
> Yes:
> $ echo Noralf Trønnes | xxd
> 0000000: 4e6f 7261 6c66 2054 72f8 6e6e 6573 0a    Noralf Tr.nnes.
>
> Is there a command I can run that shows that I'm using ISO-8859-1 ?
> I need something to google with, my previous search only gave locale stuff,
> which seems fine.
What does this give you, this is UTF-8.

$ echo git commit --author="Noralf Trønnes <notro@tronnes.org>" | xxd 0000000: 6769 7420 636f 6d6d 6974 202d 2d61 7574 git commit --aut 0000010: 686f 723d 4e6f 7261 6c66 2054 72c3 b86e hor=Noralf Tr..n 0000020: 6e65 7320 3c6e 6f74 726f 4074 726f 6e6e nes <notro@tronn 0000030: 6573 2e6f 7267 3e0a es.org>.

To see if you're using UTF-8 just look at the codepoints for the non-ASCII characters you're using and check if they're valid UTF-8. E.g. you can check this out: http://en.wikipedia.org/wiki/%C3%98#Computers

Which shows you that the UTF-8 hex version is C3 B8, but the Latin-1 is F8, you're emitting F8, I'm emitting C3 B8.

Nico Williams· Jan 20, 2015, 22:18 UTC · re: Noralf Trønnes · lore

Re: Git messes up 'ø' character

On Tue, Jan 20, 2015 at 10:38:40PM +0100, Noralf Trønnes wrote:
Show 7 quoted lines
> Yes:
> $ echo Noralf Trønnes | xxd
> 0000000: 4e6f 7261 6c66 2054 72f8 6e6e 6573 0a    Noralf Tr.nnes.
> 
> Is there a command I can run that shows that I'm using ISO-8859-1 ?
> I need something to google with, my previous search only gave locale
> stuff, which seems fine.

The locale(1) command tells you what your locale is set to, but it doesn't say anything about your input method -- it only tells you what your shell and commands started from it expect for input and what they should produce for output.

The input method will generally be part of your windowing environment, for which you'll have to search how to check/configure your OS (sometimes it can be set on a per-window basis, sometimes it's a global setting).

Even if the windowing environment is set to UTF-8, your terminal emulator might be set to ISO-8859-something, so check the terminal emulator (e.g., rxvt, Terminator, GNOME Terminal, PuTTY, ...).

Finally, check what stty(1) says (e.g., on Linux it should show that iutf8 is enabled) (this is mostly so that when you backspace in cooked mode the line discipline knows how many bytes to drop from the buffer).

Nico
Noralf Trønnes· Jan 20, 2015, 22:26 UTC · re: Nico Williams · lore

Re: Git messes up 'ø' character

Den 20.01.2015 23:18, skrev Nico Williams:
Show 21 quoted lines
> On Tue, Jan 20, 2015 at 10:38:40PM +0100, Noralf Trønnes wrote:
>> Yes:
>> $ echo Noralf Trønnes | xxd
>> 0000000: 4e6f 7261 6c66 2054 72f8 6e6e 6573 0a    Noralf Tr.nnes.
>>
>> Is there a command I can run that shows that I'm using ISO-8859-1 ?
>> I need something to google with, my previous search only gave locale
>> stuff, which seems fine.
> The locale(1) command tells you what your locale is set to, but it
> doesn't say anything about your input method -- it only tells you what
> your shell and commands started from it expect for input and what they
> should produce for output.
>
> The input method will generally be part of your windowing environment,
> for which you'll have to search how to check/configure your OS
> (sometimes it can be set on a per-window basis, sometimes it's a global
> setting).
>
> Even if the windowing environment is set to UTF-8, your terminal
> emulator might be set to ISO-8859-something, so check the terminal
> emulator (e.g., rxvt, Terminator, GNOME Terminal, PuTTY, ...).

I use putty which was set to ISO-8859-1. Changing this to UTF-8 gave me the correct result: $ echo Noralf Trønnes | xxd 0000000: 4e6f 7261 6c66 2054 72c3 b86e 6e65 730a Noralf Tr..nnes.

Thank you all for helping me!
Michael J Gruber· Jan 22, 2015, 09:59 UTC · re: Noralf Trønnes · lore

Re: Git messes up 'ø' character

Noralf Trønnes schrieb am 20.01.2015 um 23:26:
Show 30 quoted lines
> Den 20.01.2015 23:18, skrev Nico Williams:
>> On Tue, Jan 20, 2015 at 10:38:40PM +0100, Noralf Trønnes wrote:
>>> Yes:
>>> $ echo Noralf Trønnes | xxd
>>> 0000000: 4e6f 7261 6c66 2054 72f8 6e6e 6573 0a    Noralf Tr.nnes.
>>>
>>> Is there a command I can run that shows that I'm using ISO-8859-1 ?
>>> I need something to google with, my previous search only gave locale
>>> stuff, which seems fine.
>> The locale(1) command tells you what your locale is set to, but it
>> doesn't say anything about your input method -- it only tells you what
>> your shell and commands started from it expect for input and what they
>> should produce for output.
>>
>> The input method will generally be part of your windowing environment,
>> for which you'll have to search how to check/configure your OS
>> (sometimes it can be set on a per-window basis, sometimes it's a global
>> setting).
>>
>> Even if the windowing environment is set to UTF-8, your terminal
>> emulator might be set to ISO-8859-something, so check the terminal
>> emulator (e.g., rxvt, Terminator, GNOME Terminal, PuTTY, ...).
> 
> I use putty which was set to ISO-8859-1. Changing this to UTF-8 gave me 
> the correct result:
> $ echo Noralf Trønnes | xxd
> 0000000: 4e6f 7261 6c66 2054 72c3 b86e 6e65 730a  Noralf Tr..nnes.
> 
> Thank you all for helping me!
> 
You can also check the encoding of your config file with
file .git/config

or ":set fileencoding" in vim. ":set fileencoding=utf8" would allow you to convert it easily.

(This assumes that the file does not mix encodings.)
Michael

← back to recent threads