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

Re: [PATCH] $LastChangedDate$ encoding

From: Branko Čibej <brane_at_xbc.nu>
Date: 2006-04-21 22:59:54 CEST

Peter Samuelson wrote:
> The $LastChangedDate$ keyword is localized to the correct language but
> not to the correct encoding. This patch seems to help - comments?
> I tested with LC_CTYPE=hu_HU.iso88592. Effect of patch:
>
> -$LastChangedDate: 2006-04-21 06:46:54 -0500 (p, 21 ápr 2006) $
> +$LastChangedDate: 2006-04-21 06:46:54 -0500 (p, 21 ápr 2006) $
>
> I didn't check for other instances of the same bug. I seem to recall a
> bit of controversy recently regarding repository paths in keywords, but
> I don't remember the conclusion.
>
> [[[
> Fix encoding of LastChangedDate keyword expansion.
>
> * subversion/libsvn_subr/subst.c (keyword_printf):
> Convert the long-format revision date to the native encoding.
> ]]]
>
> Index: subversion/libsvn_subr/subst.c
> ===================================================================
> --- subversion/libsvn_subr/subst.c (revisione 19429)
> +++ subversion/libsvn_subr/subst.c (copia locale)
> @@ -224,8 +224,12 @@
> break;
> case 'D': /* long format of date of this revision */
> if (date)
> - svn_stringbuf_appendcstr(value,
> - svn_time_to_human_cstring(date, pool));
> + {
> + char *date_keyword;
> + char *date_utf8 = svn_time_to_human_cstring(date, pool);
> + svn_utf_cstring_from_utf8(&date_keyword, date_utf8, pool);
> + svn_stringbuf_appendcstr(value, date_keyword);
> + }
>
That's really not correct. Keywords should be expanded in the file's
internal encoding, not the locale encoding. Since we don't *know* the
file's encoding, UTF-8 is marginally better than something random, IMHO.

-- Brane

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Apr 22 23:05:26 2006

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.