views:

47

answers:

2

Hello there.

I recently acquired a MacBook. I compiled Mercurial 1.6.3, and set it all with NetBeans.

The thing is, whenever I try to commit, and since I'm writing the revision message and my name with accented characters (in Spanish), I'm getting an error like:

transaction abort!
rollback completed
abort: decoding near 'Naim? Batuta ': 'utf8' codec can't decode byte 0x8e in position 4: unexpected code byte!

I used locale on the console, and I got this:

LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

I tried setting LC_CTYPE="C.UTF-8", and now LC_CTYPE became ="C" as well, yet Mercurial keeps showing me the same message.

At first I thought it was NetBeans switching character encodings, but then I tried a simple hg commit, and it returned the same error.

I've read everywhere, and while such articles mention character encodings of Mercurial, Mac OS X, and Python, some patches to fix it (a while ago, so they should be already in Mercurial), I haven't found a real solution.

Has it happened to you before? How did you solve it? Please, help me. It works just fine on my desktop (Windows) machine, but sometimes I need to make modifications while I'm away, and this is driving me crazy.

Thanks in advance!

A: 

Your Spanish locale should be es_ES.UTF-8 (if your terminal does use UTF-8), or es_ES (which will use ISO-8859-1 encoding). "C" locale knows nothing about Spanish accentend characters.

Anyway, if properly setting locale in your terminal doesn't help, then you can try setting

[ui]
fallbackencoding=ISO-8859-1

in your .hgrc config file.

Tadeusz A. Kadłubowski
I tried all these suggestions, but none seemed to work. I keep getting the same error, whether it's an accented character in the username, or in the commit message. :'(
KaOSoFt
+1  A: 

When I issue the locale command on my mac osx, I get the following

LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL="en_US.UTF-8"

For you it should be

LANG=es_ES.UTF-8
LC_ALL=es_ES.UTF-8

Are you exporting these? Because, your locale should have shown a different value after exporting.

export LC_ALL=es_ES.UTF-8
export LANG=es_ES.UTF-8
pyfunc
Nope, it didn't work. I tried switching locales to es_ES.UTF-8, to no avail. I just didn't want to use the MacPorts port, and just wanted to try compiling it myself. It looked liked as if it had worked, until I had to put it to work. What else do you think it might be? Switch to git? :s Thanks!
KaOSoFt
By the way, I just quit the Terminal. Should I also restart? I don't think, but you never know.
KaOSoFt
Yes and I would suggest adding the two lines in .bash_profile , quit terminal and then restart and check for locale command output
pyfunc