[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

fuzzy_escape function in libsvn_subr is not reversible

From: Jendro, Carsten (SAZ-DE) <CJendro_at_saz.net>
Date: 2007-11-06 10:52:01 CET


I have a problem with svnlook when I use it to print an utf8 log message in the console.

Under windows it is not possible to set the output mode to utf8, so all text output will be escaped with the fuzzy_escape function located in libsvn_subr / utf.c

This pocess is not reversible, because every char >= 128 and 0 will be converted to a replacement in a format like "?\000". But the starting char of the replacement, the question mark (?) schould be replaced too to make it reversible.

For Example:

I use the following logmessage into svn.

> With fuzzy_escape "" will be converted to "?\195?\164"

I print it out with

svnlook.exe c:\repos -r 12345

> With fuzzy_escape "?\195?\164" will be converted to "?\195?\164"

When i try to convert this back to a correct utf8 string (may be inside a hook script) I get this:

> With fuzzy_escape "" will be converted to ""

The Function does exact what it should

> /* Copy LEN bytes of SRC, converting non-ASCII and zero bytes to ?\nnn
> sequences, allocating the result in POOL. */ static const char *
> fuzzy_escape(const char *src, apr_size_t len, apr_pool_t *pool)

But it would be nice to make it reversible.

There are only 2 lines of code that must be changed, I have done it for myself in my own hook script.

> if (! svn_ctype_isascii(*src) || *src == '\0')

> if (! svn_ctype_isascii(*src_orig) || src_orig == '\0')

Can be changed in

> if (! svn_ctype_isascii(*src) || *src == '\0' || *src == '?')

> if (! svn_ctype_isascii(*src_orig) || src_orig == '\0' || *src == '?')

It would be nice it this can be implemented into svn, so I don't have to compile my own version for my hook scripts in the future.


Carsten Jendro

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Nov 8 00:13:25 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.