* scm_{to,from}_locale_string
@ 2011-03-17 16:49 Andy Wingo
0 siblings, 0 replies; 4+ messages in thread
From: Andy Wingo @ 2011-03-17 16:49 UTC (permalink / raw)
To: Mike Gran; +Cc: guile-devel
Hi Mike,
I'm looking at changing to use the helper "locale_charset()" function
from libunistring in the scm_to_locale_string and scm_from_locale_string
functions. It seems like that's more correct than snarfing through the
current input/output ports.
Likewise I'll just use the scm_i_get_conversion_strategy for the
handler.
Please let me know if this is the wrong thing to do.
Thanks,
Andy
--
http://wingolog.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: scm_{to,from}_locale_string
@ 2011-03-17 18:38 Mike Gran
2011-03-17 22:12 ` scm_{to,from}_locale_string Andy Wingo
0 siblings, 1 reply; 4+ messages in thread
From: Mike Gran @ 2011-03-17 18:38 UTC (permalink / raw)
To: Andy Wingo; +Cc: guile-devel
> From:Andy Wingo <wingo@pobox.com>
>
> Hi Mike,
>
> I'm looking at changing to use the helper "locale_charset()"
> function
> from libunistring in the scm_to_locale_string and scm_from_locale_string
> functions. It seems like that's more correct than snarfing through the
> current input/output ports.
>
> Likewise I'll just use the scm_i_get_conversion_strategy for the
> handler.
>
> Please let me know if this is the wrong thing to do.
I'm trying to imagine a case where this is wrong.
So, if have a CGI script where the stdout could have one
a couple of different encodings based on a web client's language
preference settings, but, where the CGI program is running in a "C"
or "en_US.utf8" locale, this might count.
But presumably, any snarfing would have been done before
the CGI program reset its stdout locale before displaying its
output web content.
Would that violate your presuppositions?
-Mike
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: scm_{to,from}_locale_string
2011-03-17 18:38 scm_{to,from}_locale_string Mike Gran
@ 2011-03-17 22:12 ` Andy Wingo
2011-03-18 11:53 ` scm_{to,from}_locale_string Ludovic Courtès
0 siblings, 1 reply; 4+ messages in thread
From: Andy Wingo @ 2011-03-17 22:12 UTC (permalink / raw)
To: Mike Gran; +Cc: guile-devel
Evening,
On Thu 17 Mar 2011 19:38, Mike Gran <spk121@yahoo.com> writes:
> So, if have a CGI script where the stdout could have one
> a couple of different encodings based on a web client's language
> preference settings, but, where the CGI program is running in a "C"
> or "en_US.utf8" locale, this might count.
The thing is that we need to be giving the C library strings encoded in
the current locale, not the locale of any particular port, because
that's how library functions will decode the strings internally -- take
the regexec case, for example, recently fixed.
I think that if the CGI script wants to read or write in a particular
locale, either you set the LC_ALL/LC_CTYPE vars, do a setlocale in the
Guile script, or set the encoding on a port. But that's port encodings,
not something related to scm_{to/from}_locale_string, I don't think...
Of course, in the CGI context, the encoding of any _environment
variables_ is another thorny question, but not one that should depend on
port encodings.
Regards,
Andy
--
http://wingolog.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: scm_{to,from}_locale_string
2011-03-17 22:12 ` scm_{to,from}_locale_string Andy Wingo
@ 2011-03-18 11:53 ` Ludovic Courtès
0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2011-03-18 11:53 UTC (permalink / raw)
To: guile-devel
Andy Wingo <wingo@pobox.com> writes:
> The thing is that we need to be giving the C library strings encoded in
> the current locale, not the locale of any particular port, because
> that's how library functions will decode the strings internally -- take
> the regexec case, for example, recently fixed.
Agreed.
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-03-18 11:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-17 18:38 scm_{to,from}_locale_string Mike Gran
2011-03-17 22:12 ` scm_{to,from}_locale_string Andy Wingo
2011-03-18 11:53 ` scm_{to,from}_locale_string Ludovic Courtès
-- strict thread matches above, loose matches on Subject: below --
2011-03-17 16:49 scm_{to,from}_locale_string Andy Wingo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).