racket / db

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

odbc-driver-connect query get error when the column contains unicode characters

WuTianyi321 opened this issue · comments

Environment
Win10 1709
Racket v7.9[cs]
sql server (version 11.0.33000.0, database collation Chinese_PRC_CI_AS)

Description
I try to use the query procedure to get some data from the sql server database (version 11.0.33000.0), when the column name of the table contains unicode characters, an error occurs.
For example, run following code

#lang racket
(require db)
(define c
  (odbc-driver-connect
   "AutoTranslate=yes;DRIVER={ODBC Driver 17 for SQL Server};SERVER=localhost;DATABASE=db;UID=sa;PWD=thepassword"))
(query c "select * from t")

then return an error:

bytes->string/utf-8: byte string is not a well-formed UTF-8 encoding
byte string: #"\262\342\312\324"

The create table script is

CREATE TABLE [dbo].[t](
	[测试] [nchar](10) NULL
) ON [PRIMARY]