Re: [sqlite] Help for Garbled

2011-03-01 Thread 陈强
>> for example, i insert String filled with gbk bytes and set the String 
>> charset 'UTF-8'
>
>What do you mean, "set String charset"? Set how and where?
>-- 
>Igor Tandetnik

Hi
The String on java side is ok.
> for example, i insert String filled with gbk bytes and set the String charset 
> 'UTF-8' means this:
byte[] bytes = Utils.getGBKBytesFromUTF8(String Chinese);  //convert the bytes
String str = new String(bytes, "UTF-8");
I know this will be wrongNo doubt, but i woulld to find a type like this.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Help for Garbled

2011-03-01 Thread Igor Tandetnik
On 3/1/2011 9:49 PM, 陈强 wrote:
> How did the sqlite.exe work if insert data through it?
> insert gbk string?

Most likely. I wouldn't be surprised if these strings came out wrong on 
Java side, though.

> can I insert data like it ?

Probably, but I don't think you really want to. It'll be a struggle to 
handle such text in Java.

> for example, i insert String filled with gbk bytes and set the String charset 
> 'UTF-8'

What do you mean, "set String charset"? Set how and where?
-- 
Igor Tandetnik

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Help for Garbled

2011-03-01 Thread 陈强
>Try running this command before starting sqlite.exe, but I'm not sure 
>this will help:
>
>mode con cp select=65001


Hi
I tried to change the charset of console to utf-8 before, but it didn't work 
correctly.
Because the app will besent to custom, so i want to make sqlite.exe display 
correctly.
How did the sqlite.exe work if insert data through it?
insert gbk string? 
can I insert data like it ?
for example, i insert String filled with gbk bytes and set the String charset 
'UTF-8'
 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Help for Garbled

2011-03-01 Thread Igor Tandetnik
On 3/1/2011 8:52 PM, 陈强 wrote:
> But if i want to make the gbk console show String correctly, what should i do?

Try running this command before starting sqlite.exe, but I'm not sure 
this will help:

mode con cp select=65001


There also exists a number of nice graphical tools for working with 
SQLite databases:

http://www.sqlite.org/cvstrac/wiki?p=ManagementTools

I bet at least some of them handle UTF-8 and UTF-16 correctly.
-- 
Igor Tandetnik

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Help for Garbled

2011-03-01 Thread 陈强

At 2011-03-02 09:17:48,"Igor Tandetnik"  wrote:

>On 3/1/2011 8:05 PM, 陈强 wrote:
>> At 2011-03-01 20:56:49,"Igor Tandetnik"  wrote:
>>
>>> 陈强  wrote:
 Why is the Chinese i Selected from SQLIte.exe and jdbc is not different. 
 The Chinese from JDBC(rs.getString(index)) is normal but
 the Chinese from Sqlite.exe (Select data) is Garbled, my environment as 
 list:
>>>
>>> Console window doesn't know UTF-8. The strings are fine, but the console 
>>> can't render them correctly.
>>
>> The charSet of the String insert into db  is GBK, the console should show 
>> GBK String correctly.
>
>I'd double-check that if I were you. That would be highly unusual. How 
>do you put those strings into the database? If with a Java program, 
>realize that Java always represents all strings in UTF-16.
>
>I stronly doubt a simple rs.getString(index) would have worked correctly 
>if the string weren't stored in UTF-16 or UTF-8 in the database. SQLite 
>certainly wouldn't automatically convert from GBK to UTF-16 that Java 
>requires.
>
>
>Show the output of this query, when run in sqlite.exe:
>
>select hex(MyStringField) from MyTable limit 10;
>
>Substitute your actual table and column names for MyTable and 
>MyStringField, of course.
>-- 
>Igor Tandetnik
>

Hi
Thanks a lot for your help!
I'am a javaBeginner.
I will send the output of the query as soon as possible, because it's not in my 
pc.
But if i want to make the gbk console show String correctly, what should i do?
i know if i put the gbk bytes into db, the String will be show correctly, but 
the column type will be blob, it's not the result i wanna.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Help for Garbled

2011-03-01 Thread Igor Tandetnik
On 3/1/2011 8:05 PM, 陈强 wrote:
> At 2011-03-01 20:56:49,"Igor Tandetnik"  wrote:
>
>> 陈强  wrote:
>>> Why is the Chinese i Selected from SQLIte.exe and jdbc is not different. 
>>> The Chinese from JDBC(rs.getString(index)) is normal but
>>> the Chinese from Sqlite.exe (Select data) is Garbled, my environment as 
>>> list:
>>
>> Console window doesn't know UTF-8. The strings are fine, but the console 
>> can't render them correctly.
>
> The charSet of the String insert into db  is GBK, the console should show GBK 
> String correctly.

I'd double-check that if I were you. That would be highly unusual. How 
do you put those strings into the database? If with a Java program, 
realize that Java always represents all strings in UTF-16.

I stronly doubt a simple rs.getString(index) would have worked correctly 
if the string weren't stored in UTF-16 or UTF-8 in the database. SQLite 
certainly wouldn't automatically convert from GBK to UTF-16 that Java 
requires.


Show the output of this query, when run in sqlite.exe:

select hex(MyStringField) from MyTable limit 10;

Substitute your actual table and column names for MyTable and 
MyStringField, of course.
-- 
Igor Tandetnik

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Help for Garbled

2011-03-01 Thread 陈强
At 2011-03-01 20:56:49,"Igor Tandetnik"  wrote:

>陈强  wrote:
>> Why is the Chinese i Selected from SQLIte.exe and jdbc is not different. The 
>> Chinese from JDBC(rs.getString(index)) is normal but
>> the Chinese from Sqlite.exe (Select data) is Garbled, my environment as 
>> list: 
>
>Console window doesn't know UTF-8. The strings are fine, but the console can't 
>render them correctly.
>-- 
>Igor Tandetnik
>

 
hi.
The charSet of the String insert into db  is GBK, the console should show GBK 
String correctly.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Help for Garbled

2011-03-01 Thread Igor Tandetnik
陈强  wrote:
> Why is the Chinese i Selected from SQLIte.exe and jdbc is not different. The 
> Chinese from JDBC(rs.getString(index)) is normal but
> the Chinese from Sqlite.exe (Select data) is Garbled, my environment as list: 

Console window doesn't know UTF-8. The strings are fine, but the console can't 
render them correctly.
-- 
Igor Tandetnik

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users