Skip to content

Connection.getinfo() returns undecoded utf_16_le #318

@gordthompson

Description

@gordthompson

Describe the bug

String values returned by Connection.getinfo() are string representations of utf_16_le bytes.

To reproduce

>>> import mssql_python
>>> cnxn = mssql_python.connect(
...     "SERVER=192.168.0.199;"
...         "DATABASE=test;"
...             "UID=scott;PWD=tiger^5HHH;"
...                 "TrustServerCertificate=yes;"
...                 )
>>> driver_ver = cnxn.getinfo(mssql_python.SQL_DRIVER_VER)
>>> type(driver_ver)
<class 'str'>
>>> driver_ver
'1\x008\x00.\x000\x005\x00.\x000\x000\x000\x001'

Expected behavior

Return a normal Unicode string.

Further technical details

Python version: 3.13
SQL Server version: SQL Server 2019
Operating system: Client - Windows 11; Server - Docker container

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions