Skip to main content
Added codification.
Source Link

I'm trying to learn how the $LANG$LANG variable behaves with gnome-terminal (and its character encoding preference option). I've been using iso8859-1 (latin1) as my main character-set and all my filenames are encoded as such.

For the following tests I'll do an "ls -l"ls -l of a directory with Spanish accented characters in their filenames:

Case #1:

  • gnome-terminal configured for ISO-8859-1
  • LANGLANG set to "en_US-iso8859-1"
  • Result: I see all files correctly

Case #2:

  • gnome-terminal configured for UTF-8
  • LANGLANG set to "en_US-iso8859-1"
  • Result: I see garbage characters for all spanish characters. This is expected as I changed the character-encoding for the terminal

Case #3:

  • gnome-terminal configured for ISO-8859-1
  • LANGLANG set to "en_US-UTF-8"
  • Result: I see garbage characters for all spanish characters.

Why is that in this last case I see garbled characters? Shouldn't the output of ls send the filenames straight to gnome-terminal as they are? And since gnome-terminal is configured for ISO-8859-1, I would have expected them to look right.

For a moment I thought that, perhaps, maybe bash is considering my $LANG$LANG variable and performing some conversion. Then I switched my terminal to UTF-8 but I still can't see the characters right. I even piped the output of ls to xxd and to my surprise I still see the files encoded as they are: ISO-8859-1.

To wrap up: If my listing contains ISO-8859-1 characters and my terminal emulator is configured for the same character-encoding: Who's doing the conversion when LANGLANG is set otherwise?

Thanks for any help you can provide.

Craconia

I'm trying to learn how the $LANG variable behaves with gnome-terminal (and its character encoding preference option). I've been using iso8859-1 (latin1) as my main character-set and all my filenames are encoded as such.

For the following tests I'll do an "ls -l" of a directory with Spanish accented characters in their filenames:

Case #1:

  • gnome-terminal configured for ISO-8859-1
  • LANG set to "en_US-iso8859-1"
  • Result: I see all files correctly

Case #2:

  • gnome-terminal configured for UTF-8
  • LANG set to "en_US-iso8859-1"
  • Result: I see garbage characters for all spanish characters. This is expected as I changed the character-encoding for the terminal

Case #3:

  • gnome-terminal configured for ISO-8859-1
  • LANG set to "en_US-UTF-8"
  • Result: I see garbage characters for all spanish characters.

Why is that in this last case I see garbled characters? Shouldn't the output of ls send the filenames straight to gnome-terminal as they are? And since gnome-terminal is configured for ISO-8859-1, I would have expected them to look right.

For a moment I thought that, perhaps, maybe bash is considering my $LANG variable and performing some conversion. Then I switched my terminal to UTF-8 but I still can't see the characters right. I even piped the output of ls to xxd and to my surprise I still see the files encoded as they are: ISO-8859-1.

To wrap up: If my listing contains ISO-8859-1 characters and my terminal emulator is configured for the same character-encoding: Who's doing the conversion when LANG is set otherwise?

Thanks for any help you can provide.

Craconia

I'm trying to learn how the $LANG variable behaves with gnome-terminal (and its character encoding preference option). I've been using iso8859-1 (latin1) as my main character-set and all my filenames are encoded as such.

For the following tests I'll do an ls -l of a directory with Spanish accented characters in their filenames:

Case #1:

  • gnome-terminal configured for ISO-8859-1
  • LANG set to "en_US-iso8859-1"
  • Result: I see all files correctly

Case #2:

  • gnome-terminal configured for UTF-8
  • LANG set to "en_US-iso8859-1"
  • Result: I see garbage characters for all spanish characters. This is expected as I changed the character-encoding for the terminal

Case #3:

  • gnome-terminal configured for ISO-8859-1
  • LANG set to "en_US-UTF-8"
  • Result: I see garbage characters for all spanish characters.

Why is that in this last case I see garbled characters? Shouldn't the output of ls send the filenames straight to gnome-terminal as they are? And since gnome-terminal is configured for ISO-8859-1, I would have expected them to look right.

For a moment I thought that, perhaps, maybe bash is considering my $LANG variable and performing some conversion. Then I switched my terminal to UTF-8 but I still can't see the characters right. I even piped the output of ls to xxd and to my surprise I still see the files encoded as they are: ISO-8859-1.

To wrap up: If my listing contains ISO-8859-1 characters and my terminal emulator is configured for the same character-encoding: Who's doing the conversion when LANG is set otherwise?

Thanks for any help you can provide.

Craconia

Source Link
Craconia
  • 123
  • 1
  • 1
  • 4

Effect of $LANG on terminal

I'm trying to learn how the $LANG variable behaves with gnome-terminal (and its character encoding preference option). I've been using iso8859-1 (latin1) as my main character-set and all my filenames are encoded as such.

For the following tests I'll do an "ls -l" of a directory with Spanish accented characters in their filenames:

Case #1:

  • gnome-terminal configured for ISO-8859-1
  • LANG set to "en_US-iso8859-1"
  • Result: I see all files correctly

Case #2:

  • gnome-terminal configured for UTF-8
  • LANG set to "en_US-iso8859-1"
  • Result: I see garbage characters for all spanish characters. This is expected as I changed the character-encoding for the terminal

Case #3:

  • gnome-terminal configured for ISO-8859-1
  • LANG set to "en_US-UTF-8"
  • Result: I see garbage characters for all spanish characters.

Why is that in this last case I see garbled characters? Shouldn't the output of ls send the filenames straight to gnome-terminal as they are? And since gnome-terminal is configured for ISO-8859-1, I would have expected them to look right.

For a moment I thought that, perhaps, maybe bash is considering my $LANG variable and performing some conversion. Then I switched my terminal to UTF-8 but I still can't see the characters right. I even piped the output of ls to xxd and to my surprise I still see the files encoded as they are: ISO-8859-1.

To wrap up: If my listing contains ISO-8859-1 characters and my terminal emulator is configured for the same character-encoding: Who's doing the conversion when LANG is set otherwise?

Thanks for any help you can provide.

Craconia