Skip to content

Data becomes truncated when database uses win1251 charset and client uses UTF8 #132

Closed
@The-o

Description

@The-o

I work with a database that runs with NLS_LANG set to AMERICAN_AMERICA.CL8MSWIN1251 and have no write access to it. On my side NLS_LANG is set to AMERICAN_AMERICA.UTF8. When I execute a select statement, the result contains truncated data for cyrillic VARCHAR2 fields. It looks like the buffer for the incoming data uses its length in bytes in cp1251, not in utf8.

You can perform the following request to test this behaviour:

SELECT 'ААБББВВВ' AS "col1", RAWTOHEX('ААБББВВВ') AS "col2" FROM DUAL

I get this as a result:

[ { col1: 'ААББ', col2: 'C0C0C1C1C1C2C2C2' } ]

tcpdump shows that the server's response is correct cp1251 data with no truncation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions