1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-17 00:39:50 +02:00

Add UTF-8 charset

This commit is contained in:
Werner Koch 2001-04-20 12:21:23 +00:00
parent 397a73b685
commit 7c67adea66
8 changed files with 59 additions and 8 deletions

2
NEWS
View File

@ -38,6 +38,8 @@
was just wrong, so you might notice bad signature in some very
big files. It may be wise to keep an old copy of GnuPG around.
* New --charset=utf-8 to bypass all internal translations.
Noteworthy changes in version 1.0.4 (2000-10-17)
------------------------------------------------

View File

@ -1 +1 @@
1.0.4h
1.0.4i

View File

@ -1,3 +1,7 @@
2001-04-20 Werner Koch <wk@gnupg.org>
* gpg.sgml: Add new --charset UTF-8.
2001-04-19 Werner Koch <wk@gnupg.org>
* faq.raw: Add a note about dates displayed as ????-??-??.

View File

@ -367,7 +367,8 @@ assigned owner trust and the second is the calculated
trust value. Letters are used for the values:</para>
<variablelist>
<varlistentry><term>-</term><listitem><para>No ownertrust assigned / not yet calculated.</para></listitem></varlistentry>
<varlistentry><term>e</term><listitem><para>Trust calculation has failed.</para></listitem></varlistentry>
<varlistentry><term>e</term><listitem><para>Trust
calculation has failed; probably due to an expired key.</para></listitem></varlistentry>
<varlistentry><term>q</term><listitem><para>Not enough information for calculation.</para></listitem></varlistentry>
<varlistentry><term>n</term><listitem><para>Never trust this key.</para></listitem></varlistentry>
<varlistentry><term>m</term><listitem><para>Marginally trusted.</para></listitem></varlistentry>
@ -846,6 +847,10 @@ Valid values for &ParmName; are:</para>
<varlistentry>
<term>koi8-r</term><listitem><para>The usual Russian set (rfc1489).</para></listitem>
</varlistentry>
<varlistentry>
<term>utf-8</term><listitem><para>Bypass all translations and assume
that the OS uses native UTF-8 encoding.</para></listitem>
</varlistentry>
</variablelist>
</listitem></varlistentry>

View File

@ -1,6 +1,10 @@
2001-04-20 Werner Koch <wk@gnupg.org>
* options.skel: Add some more comments.
2001-04-19 Werner Koch <wk@gnupg.org>
* keyid.c (mk_datestr): New. Handles negative times. we must do
* keyid.c (mk_datestr): New. Handles negative times. We must do
this because Windoze segvs on negative times passed to gmtime().
Changed all datestr_from function to use this one.

View File

@ -31,6 +31,18 @@ $Id$
#default-key 621CC013
# GnuPG ultimately trusts all keys in the secret keyring. If you do
# not have all your secret keys online available you should use this
# option to tell GnuPG about ultimately trusted keys.
# You have to give the long keyID here which can be obtained by using
# the --list-key command along with the option --with-colons; you will
# get a line similiar to this one:
# pub:u:1024:17:5DE249965B0358A2:1999-03-15:2006-02-04:59:f:
# the 5th field is what you want.
#trusted-key 12345678ABCDEF01
# If you do not pass a recipient to gpg, it will ask for one.
# Using this option you can encrypt to a default key. key validation
# will not be done in this case.
@ -55,8 +67,8 @@ escape-from-lines
# If you do not use the Latin-1 (ISO-8859-1) charset, you should
# tell GnuPG which is the native character set. Please check
# the man page for supported character sets.
#charset koi8-r
# the man page for supported character sets.
#charset utf-8
# You may define aliases like this:
@ -92,4 +104,3 @@ lock-once
# this option is set.
honor-http-proxy

View File

@ -1,3 +1,10 @@
2001-04-20 Werner Koch <wk@gnupg.org>
* strgutil.c (set_native_charset): Allow utf-8 by introducing the
new no_translation variable.
(native_to_utf8): Handle no_translation.
(utf8_to_native): Ditto.
2001-04-19 Werner Koch <wk@gnupg.org>
* miscutil.c (asctimestamp): Handle negative times. We must do

View File

@ -67,7 +67,7 @@ static ushort latin2_unicode[128] = {
static const char *active_charset_name = "iso-8859-1";
static ushort *active_charset = NULL;
static int no_translation = 0;
void
free_strlist( STRLIST sl )
@ -327,16 +327,24 @@ set_native_charset( const char *newset )
{
if( !stricmp( newset, "iso-8859-1" ) ) {
active_charset_name = "iso-8859-1";
no_translation = 0;
active_charset = NULL;
}
else if( !stricmp( newset, "iso-8859-2" ) ) {
active_charset_name = "iso-8859-2";
no_translation = 0;
active_charset = latin2_unicode;
}
else if( !stricmp( newset, "koi8-r" ) ) {
active_charset_name = "koi8-r";
no_translation = 0;
active_charset = koi8_unicode;
}
else if( !stricmp (newset, "utf8" ) || !stricmp(newset, "utf-8") ) {
active_charset_name = "utf-8";
no_translation = 1;
active_charset = NULL;
}
else
return G10ERR_GENERAL;
return 0;
@ -360,7 +368,10 @@ native_to_utf8( const char *string )
byte *p;
size_t length=0;
if( active_charset ) {
if (no_translation) {
buffer = m_strdup (string);
}
else if( active_charset ) {
for(s=string; *s; s++ ) {
length++;
if( *s & 0x80 )
@ -424,6 +435,13 @@ utf8_to_native( const char *string, size_t length )
size_t slen;
int resync = 0;
if (no_translation) {
buffer = m_alloc (length+1);
memcpy (buffer, string, length);
buffer[length] = 0; /* make sure it is a string */
return buffer;
}
/* 1. pass (p==NULL): count the extended utf-8 characters */
/* 2. pass (p!=NULL): create string */
for( ;; ) {