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 6867157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:16:27+00:00 2026-05-27T03:16:27+00:00

I am working on a project where Arabic language is used and I am

  • 0

I am working on a project where Arabic language is used and I am using pyqt for the same.
There is a text box in which I enters in Arabic then take that Arabic in a variable and read it using python. I have tried using UTF-8 as well but didn’t worked.

For example I am entering

بسم الله الرحمن الرحيم

in the text box but when I read content of that box, I get the variable something as:

???? ????? ????

If I do not use the Unicode, then it gives me error as

ASCII code cannot encode characters.

How get same print variable in Arabic as entered in box ?


code is :

    item=dir(self.listWidget.selectedItems())
    item=self.listWidget.currentItem()
    content=self.textEdit.toPlainText()
    content = unicode(content, "utf-8")
    FROMADDR = ""
    LOGIN = FROMADDR
    PASSWORD = ""
    TOADDRS = str(item.text())
    SUBJECT = "Invitation"


    msg = ("From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n"
    % (FROMADDR, ", ".join(TOADDRS), SUBJECT) )
    msg += ((u"%s")%content)#"some text\r\n" 
    server = smtplib.SMTP('smtp.gmail.com', 587)
    server.set_debuglevel(1)
    server.ehlo()
    server.starttls()
    server.login(LOGIN, PASSWORD)
    server.sendmail(FROMADDR, TOADDRS, msg)
    server.quit()
  • 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-05-27T03:16:28+00:00Added an answer on May 27, 2026 at 3:16 am

    Use the appropriate email package classes to ensure the encoding is done properly:

    from email.mime.text import MIMEText
    from email.header import Header
    ...
    
    LOGIN = ''
    PASSWORD = ''
    SUBJECT = u'Invitation'
    FROMADDR = u''
    TOADDRS = unicode(self.listWidget.currentItem().text())
    CONTENT = unicode(self.textEdit.toPlainText())
    
    encoding = 'utf-8'
    
    msg = MIMEText(CONTENT, 'plain', encoding)
    msg['Subject'] = Header(SUBJECT, encoding)
    msg['From'] = Header(FROMADDR, encoding)
    msg['To'] = Header(TOADDRS, encoding)
    
    server = smtplib.SMTP('smtp.gmail.com', 587)
    server.set_debuglevel(1)
    server.ehlo()
    server.starttls()
    server.login(LOGIN, PASSWORD)
    server.sendmail(FROMADDR, [TOADDRS], msg.as_string())
    server.quit()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on project using Java , in which IP address will be identity
I have been working on project, to make a website which read files(c/c++ text
We are working on Arabic Natural Language Processing project, we have limited our choices
I'm working on an application that requires arabic text to be displayed, using custom
While working a project tonight, I ended up using one .js resource file for
I am working on project in JSF, using Tomcat 7. The application will have
I am working on project which needs setting of the project to be saved
I am working on a internationalization project. Do other languages, such as Arabic or
I am working on project which includes communication of the server (JavaEE app) and
I had a working project in VS2008 / .Net 3.5 using controls from the

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.