Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Japanese character in Linux

by prafulltc (Acolyte)
on Jul 07, 2011 at 13:00 UTC ( [id://913179]=perlquestion: print w/replies, xml ) Need Help??

prafulltc has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks ,

My Linux version is Linux version 2.6.18-194.11.4.el5 .
My perl script is retrieving japanese character from one db , assigning it to perl variables. But when I print these variable some juck characters are displayed into terminal.
Is there any setting needed at OS level. 
Please suggest.


Replies are listed 'Best First'.
Re: Japanese character in Linux
by Anonymous Monk on Jul 07, 2011 at 13:18 UTC
    You lack knowledge about encoding. Read all of that and apply what you learned.

    Show what you get from the database with Devel::Peek::Dump. You need to first decode what you received if that wasn't done already by the database driver, then encode it for output on the terminal. The locale command shows the setting, most likely you have UTF-8.

    I cannot be more specific because you did not write any details in your problem description, either.

      Thanx for reply.
      We are using Oracle DB. We are using DBD::Oracle driver and data type of column where these data is stores id NVARCHAR. 
      Oracle NLS_NCHAR enviroment variable is AL16UTF16.
      Japanese character are inserted into Sybase DB table by some other tachnology and DBI is used for sybase conenctivity.My script is fetching from Sybase table.But not Japanese character are stored into variable.So first I need to know why not actual Japanese character are fetched
      Post this what should be done to store these Japanese character into Oracle?. 

        You need to check five things:

        1. In what encoding is the data stored in the Sybase database?
        2. Does your script Encode::decode the data from the proper encoding?
        3. In what encoding is the data stored in the Oracle database?
        4. Does your script Encode::encode the data to the proper encoding?
        5. Does your script output to the console in the encoding that the console uses?
        What is the charset of the Sybase server?
        Are the strings stored in univarchar() or in varchar() columns?

        If the charset is not set to utf8, and if the columns are not univarchar(), then you need to either have the client code (DBI/DBD::Sybase) use the utf8 charset when fetching the data, or use the same charset as the dataserver.

        If the data is stored in univarchar() columns then you should set your client charset to utf8.

        DBD::Sybase 1.12 should have better support for unicode/utf8 characters, btw.


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://913179]
Approved by Corion
Front-paged by toolic
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-07-19 07:53 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.