RE: Asking again - ResultSet.getString() & unicode



Hi Dave,

I still think the problem should be environment specific since on my local
environment, no matter I use

Statement stmt = conn.createStatement();

or

Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);

I can get the unicode string correctly from sqlserver. Also, for inserting,
I can directly insert unicode in the following style:

"\u98a8";

What's your database's Collation setting? Though from my test , this
doesn't change the result, I think you can try set the collation to a
codepage which can correctly interpret the wide chars. In addition, in
T-SQL, when we inserting unicode string, it's recommended that we add "N"
Prefix for each string value, so you can try using the following insert
statement to see whether it can insert unicode correctly:

public static boolean InsertNewUser (String name, String email) throws
Exception{

Connection conn = getConnection();

String sql = "insert g_user values(N'" + name + "', N'" +
email + "')";

....................................

}


Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| Thread-Topic: Asking again - ResultSet.getString() & unicode
| thread-index: AcW1eMlyyC/Dmw/1QQyoC1z0+TfdCA==
| X-WBNR-Posting-Host: 199.45.247.98
| From: "=?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=" <thielen@xxxxxxxxxxxxx>
| References: <CEFAD23A-E1BA-479B-9923-511D6FDCE30A@xxxxxxxxxxxxx>
<7PGnYcEtFHA.1252@xxxxxxxxxxxxxxxxxxxxx>
<B25E4840-9D02-4372-A9FE-0DCD48456968@xxxxxxxxxxxxx>
<mrGDGPRtFHA.768@xxxxxxxxxxxxxxxxxxxxx>
<10F8AE17-DDB4-41B8-8D74-783D97E9E80F@xxxxxxxxxxxxx>
| Subject: RE: Asking again - ResultSet.getString() & unicode
| Date: Fri, 9 Sep 2005 12:58:03 -0700
| Lines: 10
| Message-ID: <181272BD-5477-4ECC-94C2-EF3D54A0C08F@xxxxxxxxxxxxx>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.sqlserver.odbc
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.sqlserver.odbc:2691
| X-Tomcat-NG: microsoft.public.sqlserver.odbc
|
| Sometimes a picture shows things a lot better so you can find your code
with
| some minor changes I made, and screen shots of the database at
| http://www.windward.net/jdbc2.zip
|
| Note that the first row I inserted by hand - it was not created by your
| program.
|
| --
| thanks - dave
|
|

.



Relevant Pages

  • Linguistically correct Python text rendering
    ... Unicode strings in Python? ... let's say I create this Unicode string in Arabic: ... is not correct rendering behavior for Arabic. ...
    (comp.lang.python)
  • RE: Asking again - ResultSet.getString() & unicode
    ... > I can get the unicode string correctly from sqlserver. ... Also, for inserting, ... > Microsoft Online Support ...
    (microsoft.public.sqlserver.odbc)
  • Re: invoking a method
    ... I know GET and SET methods can be used to manipulate private properties, ... convert an integer to a string and add it to another string. ... Fujitsu COM interface Class provides these methods and saves you the ... is the same as "inserting" it... ...
    (comp.lang.cobol)
  • Re: UnicodeDecodeError help please?
    ... do not hack the default encoding. ... looks like ISO-8859-1 (Latin-1) to me. ... so it's an ISO Latin-1 string. ... you're trying to combine an 8-bit string with a Unicode string, ...
    (comp.lang.python)
  • Re: byte count unicode string
    ... >> # unicode string, ... >> # string, before I can determine the size ... >UTF-8 representation of a Unicode string without manifesting the UTF-8 ... You say that your web app ...
    (comp.lang.python)