Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get Correct string( about charset )

 
zheng yu
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
TOMCAT3.2.1 + Oracle 8i + JDK1.2.2
My program get some records from database , and want to show it in browser correctly .
Interesting thing is : in DB , some fields has value like "0015","0036" ,but after i read its value from database ands print it to TOMCAT'slog , it beccomes "0x30303135"
"0x30303336", see , it seems something like ASCII code.
I know i should use :
new String ( somestring.getBytes( charsetFrom ) , charsetTo )
to get correct string that i want to display
the questions is i dont know what the charsetFrom & charsetTo will be .
another question :
Does charsetFrom has something to do with Oracle Server's encoding setting ? if it does , how can i know Oracle Server's
current encoding setting , and how can i change it ?
Thanx in advance
ZY
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Does charsetFrom has something to do with Oracle Server's encoding setting ? if it
does , how can i know Oracle Server's
current encoding setting , and how can i change it ?

Start sql then type this at the sql prompt:

SQL> select * from v$nls_parameters where parameter='NLS_CHARACTERSET';
PARAMETER
----------------------------------------------------------------
VALUE
----------------------------------------------------------------
NLS_CHARACTERSET
WE8ISO8859P1

This will indicate the Character set to you.
- satya
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic