Skip to contentSkip to conversation

Convert keymap file to UTF-8 encoding

PATCH Applied Stefan Weil 4 participants 6 messages Dec 3, 2011 – Dec 7, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Convert keymap file to UTF-8 encoding

Most QEMU files either are pure ASCII or use UTF-8. Convert this keymap file which still used ISO-8859-1 to UTF-8.

---
 pc-bios/keymaps/is |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
pc-bios/keymaps/is +1 -1
index 21dc1fd..935ac1d 100644
@@ -1,4 +1,4 @@
-# 2004-03-16 Halld�r Gu�mundsson and Morten Lange
+# 2004-03-16 Halldór Guðmundsson and Morten Lange
 # Keyboard definition file for the Icelandic keyboard
 # to be used in rdesktop 1.3.x ( See rdesktop.org)
 # generated from XKB map de, and changed manually
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 2 lines · Stefan Weil

Most QEMU files either are pure ASCII or use UTF-8. Convert this keymap file which still used ISO-8859-1 to UTF-8.

Good catch -- I'd assumed the keymap files were binary :-)

-- PMM

#3 lore raw
In reply to Stefan Weil
Quoted 13 lines · Stefan Weil

Most QEMU files either are pure ASCII or use UTF-8. Convert this keymap file which still used ISO-8859-1 to UTF-8.

---
 pc-bios/keymaps/is |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
pc-bios/keymaps/is +0 -0
index 21dc1fd..935ac1d 100644

pc-bios/keymaps/is line 1

Quoted 1 line
pc-bios/keymaps/is +0 -1
@@ -1,4 +1,4 @@
-# 2004-03-16 Halldór Guðmundsson and Morten Lange

Can you let me know how you see that it is ISO-8859-1 coding, not UTF-8? They look same to me.

Quoted 8 lines
pc-bios/keymaps/is +1 -1
+# 2004-03-16 Halldór Guðmundsson and Morten Lange
  # Keyboard definition file for the Icelandic keyboard
  # to be used in rdesktop 1.3.x ( See rdesktop.org)
  # generated from XKB map de, and changed manually
--

1.7.0.4

Signature · 3 lines
Regards,

Zhi Yong Wu
#4 lore raw
Quoted 2 lines · Zhi Yong Wu

Can you let me know how you see that it is ISO-8859-1 coding, not UTF-8? They look same to me.

This gets a bit confusing because mail clients and web browsers tend to try to fix up what they think are wrongly labelled encodings, so for example in my mail client the diff looks like it is not changing anything. However if you look at the file in the current git repo with a hex editor:

00000000  23 20 32 30 30 34 2d 30  33 2d 31 36 20 48 61 6c  |# 2004-03-16 Hal|
00000010  6c 64 f3 72 20 47 75 f0  6d 75 6e 64 73 73 6f 6e  |ld.r Gu.mundsson|

you can see that there is an 0xf3 at offset 0x12, which is LATIN SMALL LETTER O WITH ACUTE in ISO-8859-1. ISO-8859-1 is a one-byte-per-character encoding which is why it has a raw 0xf3 here. However although the character is at Unicode codepoint 0xf3 as well, the encoding of this in UTF-8 is the two byte sequence 0xc3 0xb3. Similarly the 0xf0 LATIN SMALL LETTER ETH has to be encoded as 0xc3 0xb0.

If you look at the raw text of Stefan's email it reads:
-# 2004-03-16 Halld=F3r Gu=F0mundsson and Morten Lange +# 2004-03-16 Halld=C3=B3r Gu=C3=B0mundsson and Morten Lange

which is the quoted-printable encoding of this change.

-- PMM

#5 lore raw
Quoted 25 lines · Peter Maydell
Quoted 2 lines · Zhi Yong Wu

Can you let me know how you see that it is ISO-8859-1 coding, not UTF-8? They look same to me.

This gets a bit confusing because mail clients and web browsers tend to try to fix up what they think are wrongly labelled encodings, so for example in my mail client the diff looks like it is not changing anything. However if you look at the file in the current git repo with a hex editor:

00000000  23 20 32 30 30 34 2d 30  33 2d 31 36 20 48 61 6c  |# 2004-03-16 Hal|
00000010  6c 64 f3 72 20 47 75 f0  6d 75 6e 64 73 73 6f 6e  |ld.r Gu.mundsson|

you can see that there is an 0xf3 at offset 0x12, which is LATIN SMALL LETTER O WITH ACUTE in ISO-8859-1. ISO-8859-1 is a one-byte-per-character encoding which is why it has a raw 0xf3 here. However although the character is at Unicode codepoint 0xf3 as well, the encoding of this in UTF-8 is the two byte sequence 0xc3 0xb3. Similarly the 0xf0 LATIN SMALL LETTER ETH has to be encoded as 0xc3 0xb0.

If you look at the raw text of Stefan's email it reads:

(quoted diff) +1 -1
-# 2004-03-16 Halld=F3r Gu=F0mundsson and Morten Lange
+# 2004-03-16 Halld=C3=B3r Gu=C3=B0mundsson and Morten Lange
Quoted 1 line

which is the quoted-printable encoding of this change.

thanks for your explain.

Quoted 2 lines

-- PMM

Signature · 3 lines
Regards,

Zhi Yong Wu