| |

VerySource

 Forgot password?
 Register
Search
View: 26|Reply: 15

in oracle, i can't insert into Chinese

[Copy link]

1

Threads

7

Posts

5

Credits

Newbie

Rank: 1

Credits
5

 China

Post time: 2020-2-24 11:30:01
| Show all posts |Read mode
Chinese becomes garbled after inserting records.
(It is the same whether you use the program or oracle client editing tool)
I am new to oracle, thanks for your help
Reply

Use magic Report

0

Threads

66

Posts

45

Credits

Newbie

Rank: 1

Credits
45

 China

Post time: 2020-5-8 21:15:01
| Show all posts
On what platform?
Reply

Use magic Report

0

Threads

8

Posts

7

Credits

Newbie

Rank: 1

Credits
7

 Invalid IP Address

Post time: 2020-5-8 22:45:01
| Show all posts
Character set problem What character set is your client, does not support Chinese
What character set does the server support? Does not support Chinese? The two character sets are different
Reply

Use magic Report

1

Threads

7

Posts

5

Credits

Newbie

Rank: 1

Credits
5

 China

 Author| Post time: 2020-5-9 00:30:01
| Show all posts
The server is on linux and the client is on windows. thank you
Reply

Use magic Report

0

Threads

66

Posts

45

Credits

Newbie

Rank: 1

Credits
45

 China

Post time: 2020-5-9 08:45:01
| Show all posts
If it's a windows platform

Execute in the database:
SELECT * FROM V $ NLS_PARAMETERS;


Change the value of NLS_LANG in the client registry ORACLE to the previously found NLS_LANGUAGE.NLS_CHARACTERSET
Reply

Use magic Report

0

Threads

66

Posts

45

Credits

Newbie

Rank: 1

Credits
45

 China

Post time: 2020-5-9 10:30:01
| Show all posts
That is to say, the character set of the server and the client must be the same, so that there will be no garbled characters
Reply

Use magic Report

1

Threads

7

Posts

5

Credits

Newbie

Rank: 1

Credits
5

 China

 Author| Post time: 2020-5-9 15:15:01
| Show all posts
How do I see what character set Oracle uses on Linux, can I give the command line?
Reply

Use magic Report

0

Threads

10

Posts

10

Credits

Newbie

Rank: 1

Credits
10

 China

Post time: 2020-5-9 19:15:01
| Show all posts
First you need to determine what your Oracle character set is. If your Oracle character set does not support Chinese, it will be garbled when displayed later.
The solution in Java:
Transcode Chinese to ISO and save it, and then convert from ISO to GBK when displaying, there will be no problem.

The java method of transcoding is as follows:
public static String ISO2GB (String isoStr)
{
if (isoStr == null)
return null;

String gbStr = "";
try
{
gbStr = new String (isoStr.getBytes ("ISO_8859_1"), "GBK");
}
catch (Exception e)
{
System.out.println (e);
}
return gbStr;
}
    


public static String GB2ISO (String gbStr)
{
if (gbStr == null)
return null;

String isoStr = "";
try
{
isoStr = new String (gbStr.getBytes ("GBK"), "ISO_8859_1");
}
catch (Exception e)
{
System.out.println (e);
}
return isoStr;
}
Reply

Use magic Report

1

Threads

7

Posts

5

Credits

Newbie

Rank: 1

Credits
5

 China

 Author| Post time: 2020-5-9 21:30:01
| Show all posts
I run SELECT * FROM V $ NLS_PARAMETERS; after that it shows:

NLS_LANGUAGE = SIMPLIFIED CHINESE
NLS_CHARACTERSET = WE8ISO8859P1
(I feel like these two are the emperors)
What should I do if I come down?
Reply

Use magic Report

0

Threads

10

Posts

10

Credits

Newbie

Rank: 1

Credits
10

 China

Post time: 2020-5-9 23:45:02
| Show all posts
If you want to display Chinese in the Oracle client, you need to set the character set of the Client to the character set of the Server (the character set of the database is not the character set of the system) or a subset of the character set of the Server. For details, refer to thewhbillysolution.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2020|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list