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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:58:39+00:00 2026-06-06T18:58:39+00:00

In a text file I’m processing, I have characters like ����. Not sure what

  • 0

In a text file I’m processing, I have characters like ����. Not sure what they are.

I’m wondering how to remove/convert these characters.

I have tried to convert it into ascii by using .encode(‘ascii’,’ignore’). python told me char is not whithin 0,128

I have also tried unicodedata, unicodedata.normalize(‘NFKD’, text).encode(‘ascii’,’ignore’), with the same error

Anyone help?

Thanks!

  • 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-06T18:58:40+00:00Added an answer on June 6, 2026 at 6:58 pm

    You can always take a Unicode string an use the code you showed:

    my_ascii = my_uni_string.encode('ascii', 'ignore')
    

    If that gave you an error, then you didn’t really have a Unicode string to begin with. If that is true, then you have a byte string instead. You’ll need to know what encoding it’s using, and you can turn it into a Unicode string with:

    my_uni_string = my_byte_string.decode('utf8')
    

    (assuming your encoding is UTF-8).

    This split between byte string and Unicode string can be confusing. My presentation, Pragmatic Unicode, or, How Do I Stop The Pain can help you to keep it all straight.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm processing a text file output by a scientific instrument. I do not have
I have a text file and I would like to parse it using regular
I have a text file that has a list of directory names like this:
I have a text file that looks like: text texttext texttext texttext texttext text
I have a text file that looks like this: 0000000000000000 0000000000000000 FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF 3000000000000000
I have a text file like list: -----> 2012-02-13 19:29:27.325 <http-0.0.0.0-9090-1> at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:236) at
i have a text file like this: ********** time1 ********** line of text1 line
I have a text file that has some invalid byte sequences. Emacs renders these
I have a text file that looks something like this where the first column
I have a text file that is like this: FOO BAR PIPPO PLUTO 31337

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.