Thread (28 messages) flat view 28 messages, 4 authors, 2016-06-15

Re: [PATCH 2/2] send-email: rfc2047-quote subject lines with non-ascii characters

From: Robin Rosenberg <hidden>
Date: 2016-06-15 22:44:26

Possibly related (same subject, not in this thread)

Den Saturday 29 March 2008 10.52.38 skrev Jeff King:
On Sat, Mar 29, 2008 at 10:38:48AM +0100, Robin Rosenberg wrote:
quoted
The environment variables are only part of the story. There is a langinfo
API for this. See I18N::Langinfo(3pm) that knows about those and
something else.

# perl -e 'require I18N::Langinfo; I18N::Langinfo->import(qw(langinfo
CODESET)); $codeset = langinfo(CODESET()); print "My codeset=".
$codeset."\n";'
My codeset=ISO-8859-15
Hmm, neat. So perhaps it would make sense to just use this value instead
of utf-8, and not worry about examining the actual text (since any such
examination is at best a guess, anyway)?
I think you really should try the UTF-8 guess, since a file may well be UTF-8 
even if the user locale is something else. Especially for XML files, UTF-8
is common, but there are many more cases. Look into git-gui/po for more 
examples. The probability of a UTF-8 test being wrong is just so unimaginable 
low.
PS Your 'require' is more simply written as 'use I18N::Langinfo
qw(langinfo CODESET)', or perhaps even simpler:
See the man page, from which I stole it. It suggests you wrap it all inside 
eval {}, just in case your perl does not have langinfo.

As for the is_utf8() i'm not sure what it does, but I can't make it work.

-- robin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help