Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION]I user mssql-django and how to support chinese?When inserting Chinese using SQL , it was found from the database that it was garbled。 #399

Open
HeroZ09 opened this issue May 31, 2024 · 2 comments
Labels
question Further information is requested

Comments

@HeroZ09
Copy link

HeroZ09 commented May 31, 2024

I user mssql-django and how to support chinese? When inserting Chinese using SQL , it was found from the database that it was garbled。

For example:
**test sql below:**
sql_str= "insert into CHECK_TEST (id,TITLE,AUTHOR) values (6,‘**测试哈哈哈哈哈**’,'hero花')"
cursor.execute(sql_str)
**result below:**
(Decimal('6'), '**???????**', 'hero?', None)

I use django mssql setting below:
DATABASES = {
"default": {
"ENGINE": "mssql",
"NAME": "TEST",
"USER": "TEST",
"PASSWORD": TEST,
"HOST": "TEST",
}
}

@HeroZ09 HeroZ09 added the question Further information is requested label May 31, 2024
@mShan0
Copy link
Contributor

mShan0 commented May 31, 2024

You will need to change your database's collation to one of the Chinese options.

This doc shows you how to change it: https://learn.microsoft.com/en-us/sql/relational-databases/collations/set-or-change-the-database-collation?view=sql-server-ver16

This gives more information on which collation to choose: https://learn.microsoft.com/en-us/sql/relational-databases/collations/collation-and-unicode-support?view=sql-server-ver16

@HeroZ09
Copy link
Author

HeroZ09 commented Jun 4, 2024

You will need to change your database's collation to one of the Chinese options.

This doc shows you how to change it: https://learn.microsoft.com/en-us/sql/relational-databases/collations/set-or-change-the-database-collation?view=sql-server-ver16

This gives more information on which collation to choose: https://learn.microsoft.com/en-us/sql/relational-databases/collations/collation-and-unicode-support?view=sql-server-ver16

OK,I will have a try~ thanks for your support~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants