This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
help with icov
- To: libc-alpha at sourceware dot cygnus dot com
- Subject: help with icov
- From: Chester <chester at linux dot org dot tw>
- Date: Mon, 13 Nov 2000 23:34:25 +0800 (CST)
Hi,i got some trouble with glibc-2.1.x,
I want to test my locale environment,with this program(attached file),
But when i export environment with my locale,it can't convert between
mbs/wcs,
---
(none):/usr/share/locale/zh_TW.Big5# ls -l
total 890
-rw-r--r-- 1 2415 112 635388 Dec 31 19:00 LC_COLLATE
-rw-r--r-- 1 2415 112 266900 Dec 31 19:00 LC_CTYPE
drwxr-xr-x 1 2415 112 316 Dec 31 19:00 LC_MESSAGES
-rw-r--r-- 1 2415 112 95 Dec 31 19:00 LC_MONETARY
-rw-r--r-- 1 2415 112 26 Dec 31 19:00 LC_NUMERIC
-rw-r--r-- 1 2415 112 520 Dec 31 19:00 LC_TIME
(none):/usr/share/locale/zh_TW.Big5# export LANG=zh_TW.Big5
(none):/usr/share/locale/zh_TW.Big5# export LC_ALL=zh_TW.Big5
(none):/usr/share/locale/zh_TW.Big5# locale
LANG=zh_TW.Big5
LC_CTYPE="zh_TW.Big5"
LC_NUMERIC="zh_TW.Big5"
LC_TIME="zh_TW.Big5"
LC_COLLATE="zh_TW.Big5"
LC_MONETARY="zh_TW.Big5"
LC_MESSAGES="zh_TW.Big5"
LC_ALL=zh_TW.Big5
(none):/usr/lib/gconv# pwd
/usr/lib/gconv
(none):/usr/lib/gconv# ls -l
total 150
-rwxr-xr-x 1 2415 112 117408 Dec 31 19:00 BIG5.so
-rw-r--r-- 1 2415 112 33489 Dec 31 19:00 gconv-modules
The gconv-modules include
# from to module
cost
alias BIG-FIVE// BIG5//
alias BIGFIVE// BIG5//
alias BIG-5// BIG5//
module BIG5// INTERNAL BIG5 1
module INTERNAL BIG5// BIG5 1
----
and when run with,
(none):/usr/local/bin# LD_DEBUG=files ./myarmlocale
[deleted]
00169: file=libc.so.6; needed by ./myarmlocale
00169: file=libc.so.6; generating link map
00169: dynamic: 0x400fbb90 base: 0x4001f000 size: 0x000df9f8
00169: entry: 0x40036ab4 phdr: 0x4001f034 phnum: 5
00169:
00169:
00169: calling init: /lib/libc.so.6
00169:
00169:
00169: initialize libc
00169:
00169:
00169: initialize program: ./myarmlocale
00169:
00169:
00169: transferring control: ./myarmlocale
00169:
wcs1 convert error.
wcs2 convert error.
wcs convert back mbs error.
00169:
00169: calling fini: /lib/libc.so.6
00169:
---
Well,it seems that it didn't call BIG5.so to convert,could anyone
give me a hint about it??
Chester
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <wchar.h>
main()
{
char *s1 = "嗨! 大家好。";
char *s2 = "歡迎大家來參加 1999 Open Source Workshop";
char buf[200];
wchar_t wcs1[100], wcs2[100];
setlocale(LC_CTYPE, "");
if (mbstowcs(wcs1, s1, 100) == -1)
printf("wcs1 convert error.\n");
if (mbstowcs(wcs2, s2, 100) == -1)
printf("wcs2 convert error.\n");
wcsncat(wcs1, wcs2, 100);
if (wcstombs(buf, wcs1, 200) == -1)
printf("wcs convert back mbs error.\n");
else
printf("%s\n", buf);
}