Decode SQL Server VARCHAR using column collation/codepage instead of UTF-8
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
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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
ontola/atomic-server#1625 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
VirusTotal/yara-x#777 ·
-
has_tail_capacity wraps and get_writable_raw_unchecked commits raw_len before the bounds check Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
stratum-mining/stratum#2404 ·
-
bug ci good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100