Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Japanese character in Linux

by Anonymous Monk
on Jul 07, 2011 at 13:18 UTC ( [id://913181]=note: print w/replies, xml ) Need Help??


in reply to Japanese character in Linux

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.

Replies are listed 'Best First'.
Re^2: Japanese character in Linux
by prafulltc (Acolyte) on Jul 07, 2011 at 14:14 UTC
    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?. 
    
    Thanx,
    Prafull
    

      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?
        In Sybase Japanese data columns are encoded in Shift-JIS encoding.
        
        We are retrieving this data using DBI.
        use DBI qw(:sql_types);
        
         if ( @row = $dbFOX_sth->fetchrow_array ) {
                         ( $sInstrumentNameJ, $sInstrumentShortJ )    = @row;
        
        When we print this data in unix console it comes as junk.
        
        After we get this value in a variable we pass this to a stored proc which inserts data in Oracle Nvarchar2 data type field.
        
        Here it comes as inverted ?.
        
        Please advise.
        
        
        
        
      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.

      Michael

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://913181]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-25 23:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found