mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Using nl_langinfo(CODESET) to determine the local codeset to use; libsi uses canonical codeset names
This commit is contained in:
parent
1f7c70cd49
commit
d1934a7cfd
@ -886,6 +886,7 @@ Ludwig Nussel <ludwig.nussel@web.de>
|
|||||||
for removing the LOCK_THREAD from the LIRC thread
|
for removing the LOCK_THREAD from the LIRC thread
|
||||||
for making the Makefile patch friendlier
|
for making the Makefile patch friendlier
|
||||||
for a patch that was used for implementing setting the user id
|
for a patch that was used for implementing setting the user id
|
||||||
|
for pointing out that the canonical spelling of codesets is with '-'
|
||||||
|
|
||||||
Thomas Koch <tom@harhar.net>
|
Thomas Koch <tom@harhar.net>
|
||||||
for his support in keeping the Premiere World channels up to date in 'channels.conf'
|
for his support in keeping the Premiere World channels up to date in 'channels.conf'
|
||||||
@ -1739,6 +1740,7 @@ Thomas G
|
|||||||
for suggesting to extend the version number reported with the '-V' option to also
|
for suggesting to extend the version number reported with the '-V' option to also
|
||||||
show the current APIVERSION
|
show the current APIVERSION
|
||||||
for fixing i18n characters for the Hungarian texts
|
for fixing i18n characters for the Hungarian texts
|
||||||
|
for implementing using nl_langinfo(CODESET) to determine the local codeset to use
|
||||||
|
|
||||||
David Woodhouse <dwmw2@infradead.org>
|
David Woodhouse <dwmw2@infradead.org>
|
||||||
for his help in replacing the get/put_unaligned() macros from asm/unaligned.h with
|
for his help in replacing the get/put_unaligned() macros from asm/unaligned.h with
|
||||||
|
3
HISTORY
3
HISTORY
@ -5235,3 +5235,6 @@ Video Disk Recorder Revision History
|
|||||||
- Increased APIVERSION (forgot to do that in 1.5.2 and 1.5.3).
|
- Increased APIVERSION (forgot to do that in 1.5.2 and 1.5.3).
|
||||||
- Fixed a crash in i18n character set conversion (thanks to Alexander Riedel and
|
- Fixed a crash in i18n character set conversion (thanks to Alexander Riedel and
|
||||||
Christian Wieninger for patches that cured part of the problem).
|
Christian Wieninger for patches that cured part of the problem).
|
||||||
|
- Using nl_langinfo(CODESET) to determine the local codeset to use (thanks to
|
||||||
|
Thomas Günther). The codeset names in 'libsi/si.c' have been changed to the
|
||||||
|
canonical spelling with '-' (thanks to Ludwig Nussel for pointing this out).
|
||||||
|
56
libsi/si.c
56
libsi/si.c
@ -6,7 +6,7 @@
|
|||||||
* the Free Software Foundation; either version 2 of the License, or *
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
* (at your option) any later version. *
|
* (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
* $Id: si.c 1.20 2007/06/10 09:31:34 kls Exp $
|
* $Id: si.c 1.21 2007/06/15 13:08:31 kls Exp $
|
||||||
* *
|
* *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
@ -251,27 +251,27 @@ char *String::getText(char *buffer, char *shortVersion, int sizeBuffer, int size
|
|||||||
|
|
||||||
static const char *CharacterTables1[] = {
|
static const char *CharacterTables1[] = {
|
||||||
NULL, // 0x00
|
NULL, // 0x00
|
||||||
"ISO8859-5", // 0x01
|
"ISO-8859-5", // 0x01
|
||||||
"ISO8859-6", // 0x02
|
"ISO-8859-6", // 0x02
|
||||||
"ISO8859-7", // 0x03
|
"ISO-8859-7", // 0x03
|
||||||
"ISO8859-8", // 0x04
|
"ISO-8859-8", // 0x04
|
||||||
"ISO8859-9", // 0x05
|
"ISO-8859-9", // 0x05
|
||||||
"ISO8859-10", // 0x06
|
"ISO-8859-10", // 0x06
|
||||||
"ISO8859-11", // 0x07
|
"ISO-8859-11", // 0x07
|
||||||
"ISO8859-12", // 0x08
|
"ISO-8859-12", // 0x08
|
||||||
"ISO8859-13", // 0x09
|
"ISO-8859-13", // 0x09
|
||||||
"ISO8859-14", // 0x0A
|
"ISO-8859-14", // 0x0A
|
||||||
"ISO8859-15", // 0x0B
|
"ISO-8859-15", // 0x0B
|
||||||
NULL, // 0x0C
|
NULL, // 0x0C
|
||||||
NULL, // 0x0D
|
NULL, // 0x0D
|
||||||
NULL, // 0x0E
|
NULL, // 0x0E
|
||||||
NULL, // 0x0F
|
NULL, // 0x0F
|
||||||
NULL, // 0x10
|
NULL, // 0x10
|
||||||
"UTF16", // 0x11
|
"UTF-16", // 0x11
|
||||||
"EUC-KR", // 0x12
|
"EUC-KR", // 0x12
|
||||||
"GB2312", // 0x13
|
"GB2312", // 0x13
|
||||||
"GBK", // 0x14
|
"GBK", // 0x14
|
||||||
"UTF8", // 0x15
|
"UTF-8", // 0x15
|
||||||
NULL, // 0x16
|
NULL, // 0x16
|
||||||
NULL, // 0x17
|
NULL, // 0x17
|
||||||
NULL, // 0x18
|
NULL, // 0x18
|
||||||
@ -288,21 +288,21 @@ static const char *CharacterTables1[] = {
|
|||||||
|
|
||||||
static const char *CharacterTables2[] = {
|
static const char *CharacterTables2[] = {
|
||||||
NULL, // 0x00
|
NULL, // 0x00
|
||||||
"ISO8859-1", // 0x01
|
"ISO-8859-1", // 0x01
|
||||||
"ISO8859-2", // 0x02
|
"ISO-8859-2", // 0x02
|
||||||
"ISO8859-3", // 0x03
|
"ISO-8859-3", // 0x03
|
||||||
"ISO8859-4", // 0x04
|
"ISO-8859-4", // 0x04
|
||||||
"ISO8859-5", // 0x05
|
"ISO-8859-5", // 0x05
|
||||||
"ISO8859-6", // 0x06
|
"ISO-8859-6", // 0x06
|
||||||
"ISO8859-7", // 0x07
|
"ISO-8859-7", // 0x07
|
||||||
"ISO8859-8", // 0x08
|
"ISO-8859-8", // 0x08
|
||||||
"ISO8859-9", // 0x09
|
"ISO-8859-9", // 0x09
|
||||||
"ISO8859-10", // 0x0A
|
"ISO-8859-10", // 0x0A
|
||||||
"ISO8859-11", // 0x0B
|
"ISO-8859-11", // 0x0B
|
||||||
NULL, // 0x0C
|
NULL, // 0x0C
|
||||||
"ISO8859-13", // 0x0D
|
"ISO-8859-13", // 0x0D
|
||||||
"ISO8859-14", // 0x0E
|
"ISO-8859-14", // 0x0E
|
||||||
"ISO8859-15", // 0x0F
|
"ISO-8859-15", // 0x0F
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NumEntries(Table) (sizeof(Table) / sizeof(char *))
|
#define NumEntries(Table) (sizeof(Table) / sizeof(char *))
|
||||||
|
4
tools.c
4
tools.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: tools.c 1.125 2007/06/15 12:46:38 kls Exp $
|
* $Id: tools.c 1.126 2007/06/15 13:11:12 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
@ -732,7 +732,7 @@ void cCharSetConv::SetSystemCharacterTable(const char *CharacterTable)
|
|||||||
{
|
{
|
||||||
free(systemCharacterTable);
|
free(systemCharacterTable);
|
||||||
systemCharacterTable = NULL;
|
systemCharacterTable = NULL;
|
||||||
if (!strcasestr(CharacterTable, "UTF")) {
|
if (!strcasestr(CharacterTable, "UTF-8")) {
|
||||||
// Set up a map for the character values 128...255:
|
// Set up a map for the character values 128...255:
|
||||||
char buf[129];
|
char buf[129];
|
||||||
for (int i = 0; i < 128; i++)
|
for (int i = 0; i < 128; i++)
|
||||||
|
19
vdr.c
19
vdr.c
@ -22,11 +22,12 @@
|
|||||||
*
|
*
|
||||||
* The project's page is at http://www.cadsoft.de/vdr
|
* The project's page is at http://www.cadsoft.de/vdr
|
||||||
*
|
*
|
||||||
* $Id: vdr.c 1.291 2007/06/09 12:33:53 kls Exp $
|
* $Id: vdr.c 1.292 2007/06/15 13:20:34 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
|
#include <langinfo.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@ -493,18 +494,22 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Set the system character table:
|
// Set the system character table:
|
||||||
|
|
||||||
char *LangEnv = setlocale(LC_CTYPE, "");
|
char *CodeSet = NULL;
|
||||||
if (!LangEnv)
|
if (setlocale(LC_CTYPE, ""))
|
||||||
LangEnv = getenv("LANG"); // last resort in case locale stuff isn't installed
|
CodeSet = nl_langinfo(CODESET);
|
||||||
|
else {
|
||||||
|
char *LangEnv = getenv("LANG"); // last resort in case locale stuff isn't installed
|
||||||
if (LangEnv) {
|
if (LangEnv) {
|
||||||
char *CodeSet = strchr(LangEnv, '.');
|
CodeSet = strchr(LangEnv, '.');
|
||||||
if (CodeSet) {
|
if (CodeSet)
|
||||||
CodeSet++; // skip the dot
|
CodeSet++; // skip the dot
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CodeSet) {
|
||||||
bool known = SI::SetSystemCharacterTable(CodeSet);
|
bool known = SI::SetSystemCharacterTable(CodeSet);
|
||||||
isyslog("codeset is '%s' - %s", CodeSet, known ? "known" : "unknown");
|
isyslog("codeset is '%s' - %s", CodeSet, known ? "known" : "unknown");
|
||||||
cCharSetConv::SetSystemCharacterTable(CodeSet);
|
cCharSetConv::SetSystemCharacterTable(CodeSet);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Main program loop variables - need to be here to have them initialized before any EXIT():
|
// Main program loop variables - need to be here to have them initialized before any EXIT():
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user