2013-07-30 2 views
1

pymssql 주위에 래퍼를 작성하여 제가 작업하는 DB에 연결했습니다. 유니 코드 디코드/인코딩 오류가 발생했습니다. 소스에서 오류를 줄이려고합니다. pymssql : DB 연결에서 문자 집합 옵션을 설정하면 연결이 실패합니다.

가 지정한

charset='latin1' or '이소 - 8859-1'`, 연결 다음과 같은 오류와 함께 실패합니다

File "pymssql.pyx", line 549, in pymssql.connect (pymssql.c:7672) 
    raise OperationalError(e[0]) 
pymssql.OperationalError: (20017, 'DB-Lib error message 20017, severity 9:\nUnexpected EOF from the server\nDB-Lib error message 20002, severity 9:\nAdaptive Server connection failed\n') 

DB를 인코딩 것으로 보이는'라틴 '

SELECT SERVERPROPERTY('Collation') 

반환

SQL_Latin1_General_CP1_CI_AS 

이것은 파이썬의 'latin1'과 같습니다.

제대로하고 있습니까? 내가 코딩 잘못 선택 했나 (즉, latin1 또는 iso-8859-1은?

답변

0

당신이 입력 한 내용에 대해 매우 까다로운 것 같습니다.

같은 ISO-8859- "등의 charset="ISO-8859-1"

-1

사용 대문자를 입력 고려 1 '또는'LATIN1 ".

pymssql는 GNU의 iconv의 규칙을 사용하고있다. https://www.gnu.org/software/libiconv/

For historical reasons, international text is often encoded using a language or country dependent character encoding. With the advent of the internet and the frequent exchange of text across countries - even the viewing of a web page from a foreign country is a "text exchange" in this context -, conversions between these encodings have become important. They have also become a problem, because many characters which are present in one encoding are absent in many other encodings. To solve this mess, the Unicode encoding has been created. It is a super-encoding of all others and is therefore the default encoding for new text formats like XML.

Still, many computers still operate in locale with a traditional (limited) character encoding. Some programs, like mailers and web browsers, must be able to convert between a given text encoding and the user's encoding. Other programs internally store strings in Unicode, to facilitate internal processing, and need to convert between internal string representation (Unicode) and external string representation (a traditional encoding) when they are doing I/O. GNU libiconv is a conversion library for both kinds of applications.

0,123,
관련 문제