conversion of a input function to i18n


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users conversion of a input function to i18n
# 1  
Old 06-07-2006
conversion of a input function to i18n

m using unix c with curses
im trying out the conversion of an existing code in c to i18n for the japanese language.
the problem is that, the input which is given as the japanese characters is not taken correctly.
and what it outputs is question marks(i.e. ???), equivalent to the number o f japanese characters.
im doing this in ja_JP.utf8 locale

it check for a pattern matching in the switch case, but it does not enter the particular case..

help me at the earliest
# 2  
Old 06-07-2006
Certainly. My psychic powers are telling me that your code is failing because...

Wait, I don't have psychic powers. Dang.

Could we see your code please?
# 3  
Old 06-07-2006
Try to verify the codepoints you get getting are really Unicode codepoints, as you can cross check the character-codepoint mappings with the Unicode character database online, and that your console really supports multibyte UTF-8 characters. Bear in mind that you may need to do some conversion between the legacy Japanese encoding and UTF-8 with iconv in certain environments. Also check whether you have the Unicode fonts which contain the Japanese characters on your OS, and whether those fonts are indeed used to render the console text.
# 4  
Old 06-08-2006
hello cbkihong....

can u please tell me the procedure to do so..... i mean how to do conversion between utf-8 and japanese encoding...
the code is working fine on ja_JP.eucJP locale but not on ja_JP.utf8 locale
# 5  
Old 06-08-2006
As my C memory is fading, maybe I will give you some directions rather than actual code. I am not familiar with the Japanese encodings actually, so I will state the general way of handling it.

As I said, the first thing before you start is to check whether you really are getting UTF-8 character code sequence from your input. Do you have gucharmap (Gnome Unicode character map) installed? It will help you check the UTF-8 representation quickly by entering a character from search.

http://gucharmap.sourceforge.net/

Also check your terminal that it can support the UTF-8 encoding with proper font. Check that you can read the content of a UTF-8 encoded Japanese text file, for instance, by "cat" should normally be sufficient to test it.

Then you can enter a Japanese character as input in your program, then read the char* from the input and use sprintf() to dump the character code. Just check that the sequence matches the UTF-8 character sequence then you know your input is in Unicode. Note that Japanese characters are represented in UTF-8 3 bytes each.

Encoding conversion between legacy JP encoding and UTF-8 is only needed if your input and output encodings differ. If you are sure both are UTF-8, then you don't need encoding conversion. Encoding conversion can be conducted with the iconv library.

You can find more information in the following documents:
http://www.tldp.org/HOWTO/Unicode-HOWTO.html
http://www.debian.org/doc/manuals/intro-i18n/

You may also find this thread with an example on iconv useful:
https://www.unix.com/showthread.php?t...ighlight=iconv

For background information on Unicode, you should find certain chapters (especially the introductory chapters) from the Unicode specification useful:
http://www.unicode.org/versions/Unicode4.1.0/
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Passing Input To Function

May i please know why is it printing the script name for $0 when i pass those parameters to function. #!/bin/bash -x usage() { echo "In Usage Function" echo $0 echo $1 echo $2 } echo "printing first time" echo $0 echo $1 echo $2 usage $0 $1 $2 Output: (2 Replies)
Discussion started by: Ariean
2 Replies

2. Shell Programming and Scripting

function terminating if i give input as space or no input and enter

HI i have written a script to ask input from the user. this script should promote the user for y/n input. if user enters anyother input then y/n the script promotes him again. this below code is working fine for all the cases. except for space and enter " if i give space and enter it is... (2 Replies)
Discussion started by: BHASKARREDDY006
2 Replies

3. Shell Programming and Scripting

NAWK conversion of hexadecimal input to decimal output via printf, I am close I can feel it

I have searched and the answers I have found thus far have led me to this point, so I feel I am just about there. I am trying to convert a column of hexadecimal to decimal values so that I can filter out via grep just the data I want. I was able to pull my original 3 character hex value and... (10 Replies)
Discussion started by: PCGameGuy
10 Replies

4. Shell Programming and Scripting

conversion of input date in reverse order

Dear all, I am having date as input 01-08-2011 ...i want to convert it by removing - (hyphens) in reverse order...i.e 20110801 can u please help me (1 Reply)
Discussion started by: suryanarayana
1 Replies

5. Shell Programming and Scripting

function from shell input

Hi all i have the command called printer which needs a usernmae for example i would run the commnad printer <username> how can i write i quick script in perl that if the username is ab then write "denined" and if it is anything else it will work thanks Adam (1 Reply)
Discussion started by: ab52
1 Replies

6. Programming

Binary conversion function

Is/are there any function(s) in C that convert(s) character/ASCII/Decimal to binary and vice versa? what about bcopy and strcpy? (1 Reply)
Discussion started by: Peevish
1 Replies

7. AIX

function trace back and address to line number conversion

Hi, I am new to AIX and I am developing a small tool for our product which helps debug memory leaks etc. Q1)Is there a way in which i can get a function trace back as to the call (lets say malloc() )has been made in which file--> in which function. I tried using the #pragma options (... (0 Replies)
Discussion started by: Wkdunreal
0 Replies

8. Linux

Help regarding understanding of i18N and L10N concepts

Hi everyone, I would like to have good understanding of i18N & L10N implementations in Linux. What does it mean actually,interms of software development? Where it is used and how it is used? It would be more helpful to me, if anyone send me the links to "basics of i18N... (0 Replies)
Discussion started by: Aeon
0 Replies

9. UNIX for Dummies Questions & Answers

Date format conversion function

Hello, does somebody knows about a function that would convert a date like: YYMMDD into a date like YYYY-MM-DD ? Thank you for your ideas :) (9 Replies)
Discussion started by: Cecile
9 Replies

10. Shell Programming and Scripting

awk - input function

hello, im a newbie. how can i input data from keyboard? thanks. (3 Replies)
Discussion started by: Jariya
3 Replies
Login or Register to Ask a Question