Decode SQL Server VARCHAR using column collation/codepage instead of UTF-8

Đang mở
#1 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
52/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
rust, sql
Lĩnh vực
database

Hướng nghiên cứu

Start in src/value.rs at the MssqlType::VarChar branch and trace what collation or type metadata is available through value.type_info. Reproduce the shown VARCHAR query with non-ASCII text, then verify that the value no longer becomes a decode error or that callers receive enough raw information for a fallback.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

sqlx-sqlserver 0.0.3 currently decodes MssqlType::VarChar with std::str::from_utf8(bytes). That works for ASCII, but SQL Server VARCHAR bytes are encoded according to the column/database collation code page, not necessarily UTF-8.\n\nRepro shape observed while migrating SQLPage to sqlx-sqlserver:\n\nsql\nselect 'Tu gères '';'' et ''"'' ?' as msg;\n\n\nAgainst SQL Server this returns a VARCHAR value. Decoding it as String fails with an invalid UTF-8 sequence for the non-ASCII byte, so SQLPage sees the value as a decode error/null. The same text works when the query uses an NVARCHAR literal:\n\nsql\nselect N'Tu gères '';'' et ''"'' ?' as msg;\n\n\nThe relevant code appears to be in src/value.rs:\n\nrust\nif matches!(value.type_info.kind(), MssqlType::VarChar) {\n return Ok(std::str::from_utf8(bytes)?.to_owned());\n}\n\n\nExpected behavior: VARCHAR should be decoded according to the SQL Server codepage/collation metadata, or the crate should expose enough raw value information for callers to perform that fallback themselves.\n\nSQLPage can work around tests by using NVARCHAR literals where Unicode is required, but user queries returning existing VARCHAR columns with non-ASCII text will still hit this.

Ngôn ngữ chính
Rust
Star
4
Fork
0
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.