• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

any chance to know the charset of a remote database?

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i need to retrieve some chinese characters from db, well, seems that's sth i cant do properly without knowing its charset first

anyone thoughts?
Regards
 
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What database? MySQL has SHOW CHARACTER SET since 4.1.

Cheers,
 
Max Durham
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i meant via jdbc, i gotta write a snippet to tell what the charset is in the server side and then retrieve the character with corresponding charset in the client side
eg.
server client
utf8 iso-8859-1
gbk gbk

any thoughts?
Cheers
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm facing exactly same problem, I have to dislay some Danish characters.
When I try to do so I get a '?' in place of the character.

Tried converting the String returned from <resultset>.getString("TITLE"); method in to Byte array and passing it to String constructor, that is :-> String(byte[],"UTF-16") that creates String out of the byte array using the Encoding passed as second parameter.
 
Tom Blough
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Again, what database? Using JDBC with MySQL you execute "SHOW CHARACTER SET;". The single row result set then contains the character set name the database uses.

Refer to Chapter 10 in MySQL documentation for more info on character set support in MySql.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use "utl_i18n.get_default_charset" function in Oracle to get the CharacterSet.
Syntax :
utl_i18n.get_default_charset(language IN VARCHAR2,
context IN PLS_INTEGER DEFAULT GENERIC_CONTEXT,
iswindows IN BOOLEAN DEFAULT FALSE) RETURN VARCHAR2;

Like :
SELECT utl_i18n.get_default_charset(<Your_language_name>,0) FROM dual;
 
Time flies like an arrow. Fruit flies like a banana. Steve flies like a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic