You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Norbert Unterberg <nu...@gmail.com> on 2006/11/09 21:02:35 UTC

How to set text encoding of svn command line tools

I posted on the users list but got no reply, so I try again on the dev list.

Is there a way to specify the encoding used by the subversion command
line tools to print information?

I am on a windows box, trying to implement a post-commit hook. I am
using svnlook to get the current commit's log message, but it is
always in the text encoding of the windows XP command prompt (cp850 in
this case). But I need the message in either UTF-8 or ANSI encoding
(the way it was entered). I tried something like SET LANG=en_US.utf8
and SET LANG=en_US.utf-8, but all it did was change the subversion
output language (german to
english).

So how can I change the text encoding?

Thank you,
Norbert

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: How to set text encoding of svn command line tools

Posted by Erik Huelsmann <eh...@gmail.com>.
> Is there a way to specify the encoding used by the subversion command
> line tools to print information?
>
> I am on a windows box, trying to implement a post-commit hook. I am
> using svnlook to get the current commit's log message, but it is
> always in the text encoding of the windows XP command prompt (cp850 in
> this case). But I need the message in either UTF-8 or ANSI encoding
> (the way it was entered). I tried something like SET LANG=en_US.utf8
> and SET LANG=en_US.utf-8, but all it did was change the subversion
> output language (german to
> english).
>
> So how can I change the text encoding?

I don't think you can.

Bye,

Erik.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: How to set text encoding of svn command line tools

Posted by Norbert Unterberg <nu...@gmail.com>.
2006/11/12, "Martin v. Löwis" <Ma...@hpi.uni-potsdam.de>:
> Norbert Unterberg schrieb:

> > So how can I change the text encoding?
>
> Command line tools, on Windows, will use the result of
> GetConsoleOutputCP as their output encoding, see
> subversion/libsvn_subr/cmdline.c:svn_cmdline_init.
>
> So to change it, you need to change the encoding of the
> terminal. Use chcp.exe to do so.

Thank you for this input, I am a step further now. But it still does not work:
After some googling I found out:

1. you need to start the console with CMD /U to enable unicode
2. The code page for UTF-8 is 65001.

after I issue
cmd /U
chcp 65001
other applications really use UTF-8 as output encoding, but SVN 1.4.0 does not:

D:\test\>svnlook log -r 3 test
Commit Message mit ?\195?\156mlauten:
?\195?\164?\195?\182?\195?\188?\195?\159

There seems to be a duplicate encoding problem; instead of using UTF-8
for the output, all non-ascii characters appear as ?\nnn.

Norbert

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: How to set text encoding of svn command line tools

Posted by "Martin v. Löwis" <Ma...@hpi.uni-potsdam.de>.
Norbert Unterberg schrieb:
> I am on a windows box, trying to implement a post-commit hook. I am
> using svnlook to get the current commit's log message, but it is
> always in the text encoding of the windows XP command prompt (cp850 in
> this case). But I need the message in either UTF-8 or ANSI encoding
> (the way it was entered). I tried something like SET LANG=en_US.utf8
> and SET LANG=en_US.utf-8, but all it did was change the subversion
> output language (german to
> english).
> 
> So how can I change the text encoding?

Command line tools, on Windows, will use the result of
GetConsoleOutputCP as their output encoding, see
subversion/libsvn_subr/cmdline.c:svn_cmdline_init.

So to change it, you need to change the encoding of the
terminal. Use chcp.exe to do so.

Regards,
Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org