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

Re: Volunteer for #872? (apr-iconv/xlate stuff, esp Win32)

From: Martin Hauner <hauner_at_web.de>
Date: 2003-09-10 23:42:56 CEST

brane@xbc.nu wrote:

> Here's what needs to be done with Issue #872:
>
> * Define two new charset conversion functions: one that converts
> from the console input encoding to UTF-8, and one that converts
> from UTF-8 to the console output encoding. On Unix, these will
> just map to the existing to/from-UTF-8 functions.
> * Change the Windows portion of svn_cmdline_init to stop calling
> SetConsole[Outpu]CP, and instead call GetConsole[Output]CP and
> store both values. These will be used by the two new functions.
> * Use the new conversion functions wherever anything is printed to
> or read form the console.

I have already started on something like this. I have created an
svn_console_string_from_native method that converts a string from the
native locale to the console codepage. It gets the codepage from this
method:

+const char* svn_console_get_output_cp ( apr_pool_t *pool )
+{
+#ifdef SVN_WIN32
+
+ UINT cp = GetConsoleOutputCP ();
+ return apr_psprintf (pool, "%d", cp);
+
+#else
+
+ /* where do we get the console codepage on a non Windows box? */
+ return APR_LOCALE_CHARSET;
+ //return apr_os_locale_encoding (pool);
+
+#endif
+}

I copied most of the xlate stuff from libsvn_subr/utf.c. Its the same
code, just a different code page to convert to.

Now the question is, is the stuff from utf.c used elsewhere or is
it just used for converting input to utf8 and utf8 to output?

If it is only used for input/output conversion it would be enough
to modify utf.c to use a method like svn_console_get_output_cp to get
its source/destination codepage.

There is another question. I have noticed that if I add 8-bit
characters to the printf statements (I played with the
log_message_receiver in cmd-log.c) their output on the console is
wrong too. Maybe its worth to create a c(onsole)printf method that
would do the console conversion and then call printf.
This way If I want to print something to the console I just call
cprintf and I wouldn't need extra calls to take care of the conversion.

-- 
Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Sep 10 23:35:32 2003

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.