Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7752049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:42:08+00:00 2026-06-01T11:42:08+00:00

I want to get a field in SQL server 2008 from python 2.6. Here

  • 0

I want to get a field in SQL server 2008 from python 2.6. Here is my freeTDS .conf file:

[ARGSERVER03]
    host = 192.168.1.3
    port = 1433
    tds version = 7.0

Here is the code:

conn = pymssql.connect(host='192.168.1.3', user='****', password='****', database='TrafficMonitor', as_dict=True, charset='UTF-8')
i = 0
cur.execute('SELECT * FROM dbo.tblTrafficCounterData')
while i < 10:
    car = cur.fetchone_asdict()
    if car is None:
        break
    c = car['Class']
    print c
    i = i + 1

But it gives:

UnicodeDecodeError: 'utf8' codec can't decode byte 0xd3 in position 0: invalid continuation byte

The Unicode field is in Persian. The trace back is for line car = cur.fetchone_asdict()

[Edit]

I have checked for database collation in database properties from sql server management studio and it is:

Arabic_CI_AS

But when I use that in charset it gives:

LookupError: unknown encoding: Arabic_CI_AS
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T11:42:09+00:00Added an answer on June 1, 2026 at 11:42 am

    Are you extremely sure that SQL Server is using UTF-8 (indicated by your charset='UTF-8')? Typically most SQL Server instances I have run into use a Microsoft encoding (not UTF-8), such as cp1252 (in the U.S.).

    A few things that may help you discover the correct encoding:

    SELECT DATABASEPROPERTYEX('dbname', 'Collation') SQLCollation

    • http://msdn.microsoft.com/en-us/library/ms143508.aspx
    • Python Encodings Table
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to return all rows from a SQL Server 2008 database table into
I want to return a private field from a remoted object but i get
I want to check if a particular char I get from the text field
I want to get a field from the last tuple I have inserted to
I'm inserting records from one sql server db into another. I need to get
I need to pull data for a report from a SQL Server 2008 R2
I want to delete rows from a SQL Server 2000/2005 table variable based on
I am performing some test on sql server and I want to get the
i am newbie in sql server, my requirement is i want to get the
I'm trying to move data from an Oracle (10g) database to SQL-Server (2008). I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.