You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by "David E. Wheeler" <da...@kineticode.com> on 2008/02/20 20:09:41 UTC
svnlook Output Encoding
Howdy,
I'm trying to figure out why svnlook sometimes seems to output UTF-8
and sometimes does not, depending on the subcommand. Here's what I get
for `info`:
% svnlook info /usr/local/svnroot -r3448
theory
2008-02-20 09:49:20 -0800 (Wed, 20 Feb 2008)
139
I think I can ?\194?\171eliminate?\194?\187 the `_encode()` and
`_decode()` methods. So let's see how things work with them doing
nothing.
But here's what i get for `diff`:
% svnlook diff /usr/local/svnroot -r3448
Modified: SVN-Notify/trunk/t/smtp.t
===================================================================
--- SVN-Notify/trunk/t/smtp.t 2008-02-20 01:02:18 UTC (rev 3447)
+++ SVN-Notify/trunk/t/smtp.t 2008-02-20 17:49:20 UTC (rev 3448)
@@ -73,9 +73,12 @@
'Check Date';
# Check that the log message is there.
-like $smtp->{datasend},
- qr/Did this, that, and the «other»\. And then I did some more\.
Some\nit was done on a second line\./,
- 'Check for log message';
+UTF8: {
+ use utf8;
+ like $smtp->{datasend},
+ qr/Did this, that, and the «other»\. And then I did some more
\. Some\nit was done on a second line\./,
+ 'Check for log message';
+}
##############################################################################
# Test authentication and Debug.
Notice how in the output of `info` (or `log`, for that matter) I get
bogus escapes around the word "eliminate", while when they properly
show up as « and » in the output of `diff`. I'm assuming that svnlook
is converting from UTF-8 to something else, but only for the log
message. How annoying. I don't have any UTF-8 locales on this box
(very old FreeBSD), but when I try `svn diff` on a newer box with the
environment variable set, it works:
% LANG=en_US.UTF-8 svn log -r3448
------------------------------------------------------------------------
r3448 | theory | 2008-02-20 09:49:20 -0800 (Wed, 20 Feb 2008) | 2 lines
I think I can «eliminate» the `_encode()` and `_decode()` methods. So
let's see how things work with them doing nothing.
I get the escapes if I set LANG=C
LANG=C svn log -r3448
------------------------------------------------------------------------
r3448 | theory | 2008-02-20 09:49:20 -0800 (Wed, 20 Feb 2008) | 2 lines
I think I can ?\194?\171eliminate?\194?\187 the `_encode()` and
`_decode()` methods. So let's see how things work with them doing
nothing.
So, my question is this: How can I get `svnlook info` to properly
output UTF-8 characters like `svnlook diff` does, without setting the `
$LANG` environment variable (since the box has no UTF-8 locales)?
Many thanks,
David
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: svnlook Output Encoding
Posted by "David E. Wheeler" <da...@kineticode.com>.
On Feb 20, 2008, at 23:11, Ryan Schmidt wrote:
> Set the LANG environment variable to a locale that your terminal
> supports and that contains the characters you want to output.
Thanks. I tried this:
* In my Mac OS X Terminal preferences, I set the character encoding to
latin-1.
* Tried it out locally with `svn log`:
LANG=en_US.ISO8859-1 svn log -r3448
------------------------------------------------------------------------
r3448 | theory | 2008-02-20 09:49:20 -0800 (Wed, 20 Feb 2008) | 2 lines
I think I can «eliminate» the `_encode()` and `_decode()` methods. So
let's see how things work with them doing nothing.
So far so good.
* Then I ssh'd to my svn server running on FreeBSD 4.x and tried
`svnlook log`:
LC_ALL=en_US.ISO8859-1 LANG=en_US.ISO8859-1 /usr/local/bin/svnlook
log /usr/local/svnroot -r3448
I think I can ?\194?\171eliminate?\194?\187 the `_encode()` and
`_decode()` methods. So let's see how things work with them doing
nothing.
Damn, it didn't work. This is in fact a valid locale on that BSD
system:
% ls -l /usr/share/nls | grep en_US
drwxr-xr-x 2 root wheel 512 Sep 18 2001 en_US.DIS_8859-15
drwxr-xr-x 2 root wheel 512 Jul 14 2003 en_US.ISO8859-1
drwxr-xr-x 2 root wheel 512 Jul 14 2003 en_US.ISO8859-15
lrwxrwxrwx 1 root wheel 15 Nov 8 2006 en_US.ISO_8859-1 ->
en_US.ISO8859-1
lrwxrwxrwx 1 root wheel 16 Nov 8 2006 en_US.ISO_8859-15 ->
en_US.ISO8859-15
lrwxrwxrwx 1 root wheel 1 Nov 8 2006 en_US.US-ASCII -> C
So that's a drag.
Is there no way at all to get `svnlook info` or `svnlook log` to just
output stuff in binary as I assume `svnlook diff` does?
Also, since I'm actually doing this from inside a Perl script that
runs as a post-commit hook, where the environment is pretty sparse,
it'd be nice to tell svnlook how to output stuff.
Thanks,
David
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: svnlook Output Encoding
Posted by Ryan Schmidt <su...@ryandesign.com>.
On Feb 20, 2008, at 14:09, David E. Wheeler wrote:
> I'm trying to figure out why svnlook sometimes seems to output
> UTF-8 and sometimes does not, depending on the subcommand. Here's
> what I get for `info`:
>
> % svnlook info /usr/local/svnroot -r3448
> theory
> 2008-02-20 09:49:20 -0800 (Wed, 20 Feb 2008)
> 139
> I think I can ?\194?\171eliminate?\194?\187 the `_encode()` and
> `_decode()` methods. So let's see how things work with them doing
> nothing.
>
> But here's what i get for `diff`:
>
> % svnlook diff /usr/local/svnroot -r3448
> Modified: SVN-Notify/trunk/t/smtp.t
> ===================================================================
> --- SVN-Notify/trunk/t/smtp.t 2008-02-20 01:02:18 UTC (rev 3447)
> +++ SVN-Notify/trunk/t/smtp.t 2008-02-20 17:49:20 UTC (rev 3448)
> @@ -73,9 +73,12 @@
> 'Check Date';
>
> # Check that the log message is there.
> -like $smtp->{datasend},
> - qr/Did this, that, and the «other»\. And then I did some more
> \. Some\nit was done on a second line\./,
> - 'Check for log message';
> +UTF8: {
> + use utf8;
> + like $smtp->{datasend},
> + qr/Did this, that, and the «other»\. And then I did some
> more\. Some\nit was done on a second line\./,
> + 'Check for log message';
> +}
>
>
> ######################################################################
> ########
> # Test authentication and Debug.
>
> Notice how in the output of `info` (or `log`, for that matter) I
> get bogus escapes around the word "eliminate", while when they
> properly show up as « and » in the output of `diff`. I'm assuming
> that svnlook is converting from UTF-8 to something else, but only
> for the log message. How annoying. I don't have any UTF-8 locales
> on this box (very old FreeBSD), but when I try `svn diff` on a
> newer box with the environment variable set, it works:
>
> % LANG=en_US.UTF-8 svn log -r3448
> ----------------------------------------------------------------------
> --
> r3448 | theory | 2008-02-20 09:49:20 -0800 (Wed, 20 Feb 2008) | 2
> lines
>
> I think I can «eliminate» the `_encode()` and `_decode()` methods.
> So let's see how things work with them doing nothing.
>
> I get the escapes if I set LANG=C
>
> LANG=C svn log -r3448
> ----------------------------------------------------------------------
> --
> r3448 | theory | 2008-02-20 09:49:20 -0800 (Wed, 20 Feb 2008) | 2
> lines
>
> I think I can ?\194?\171eliminate?\194?\187 the `_encode()` and
> `_decode()` methods. So let's see how things work with them doing
> nothing.
>
> So, my question is this: How can I get `svnlook info` to properly
> output UTF-8 characters like `svnlook diff` does, without setting
> the `$LANG` environment variable (since the box has no UTF-8 locales)?
Set the LANG environment variable to a locale that your terminal
supports and that contains the characters you want to output.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org