Skip to main content

All Questions

Tagged with
2 votes
2 answers
75 views

os.device_encoding changes when called from a subprocess, causing decoding error on Windows. How to force encoding in subprocess?

I have the following Python 3.7 code in an imported package, not modifiable by myself, that reads and decodes the systems CCompiler name provided by disttools: subproc.py import os import sys import ...
Energeneer's user avatar
0 votes
1 answer
48 views

Unable to parse non-ASCII characters from exported Instagram chat log [duplicate]

I requested a data download from Instagram and I chose the JSON format. However, when I got the file and unzipped it, every non-ASCII character was represented as a Unicode escape sequence. E.g.: &...
TLeo's user avatar
  • 115
1 vote
0 answers
96 views

UnicodeDecodeError with FastAPI when Handling Audio Files: How to Resolve?

I'm encountering a UnicodeDecodeError in my FastAPI application while processing audio files. The error traceback is as follows: Traceback (most recent call last): File "C:\Users\sanja\AppData\...
user avatar
0 votes
1 answer
63 views

Unicode strings in a purely python3 codebase - are these useless? [duplicate]

In the codebase that I'm working on, there seems to be remnants of python2 because a lot of the strings are prefixed with u. From researching, it looks like this denotes a unicode string, but in ...
NFeruch - FreePalestine's user avatar
1 vote
0 answers
45 views

How to store binary data (in the form of 0s and 1s) as a set of 8 0s and 1s as 1 byte each into a file [duplicate]

I have a string of 0s and 1s. I want to take groups of 8 of these digits and assume them as a single byte and write it into a file to save as much space as possible. How should I encode this so that ...
Musharraf Abdullah's user avatar
0 votes
0 answers
119 views

encode method for UTF16 and UTF32 in Python [duplicate]

I want to investigate how do UTF16 and UTF32 work by looking specific characters in binary. I know we can user "string".encoding("(encoding name)") to check its hex value in ...
Wei Songhome's user avatar
0 votes
0 answers
50 views

Rename folders with defective encoded german Umlauts

I have a folder with lots of subfolders with defective encoded german Umlauts. Examples: Könige (K\xc3\x83\xc2\xb6nige) -> Könige Realität (Realit\xc3\x83\xc2\xa4t) -> Realität I wrote a ...
a_cold's user avatar
  • 1
0 votes
0 answers
348 views

Python error when trying to read csv file in Colab

I need to read the weather.csv file, I have it saved in my google drive and have mounted it with: from google.colab import drive drive.mount('/content/gdrive') Following this the code I am trying is: ...
Louisa Wareing's user avatar
0 votes
0 answers
44 views

How to handle non-ASCII characters when reading a file in a Python script? [duplicate]

I am working on a Python script that needs to read data from a file containing non-ASCII characters. However, when I run my script, I encounter the following error message: "UnicodeDecodeError: '...
Joshua Rose's user avatar
1 vote
2 answers
725 views

Wrong encoding when redirecting printed unicode characters on Windows PowerShell

Using python 3, running the following code print("some box drawing:") print("┌─┬┼┴┐") via py my_app.py prints some box drawing: ┌─┬┼┴┐ As you would expect. However, if you ...
Neuron's user avatar
  • 5,931
4 votes
1 answer
3k views

In Pyvis I get UnicodeEncodeError: 'charmap' codec can't encode characters in position 263607-263621: character maps to <undefined>

In pyvis, Why I get this error when I am trying to visualise a simple graph (3 lines of codes only)? net=Network(notebook=True, cdn_resources='in_line') net.from_nx(nx.davis_southern_women_graph()) ...
Travelling Salesman's user avatar
0 votes
0 answers
44 views

Unicode encoder error in LatentDirichletAllocation

When I tried to perform LatentDirichlet Allocation on an array,it kept showing UnicodeEncodeError Traceback (most recent call last) <timed exec> in <module> D:\...
Alex's user avatar
  • 81
0 votes
0 answers
197 views

Converting a Hindi PDF to Editable Text in Docx with Proper Text Encoding Detection and Conversion

This code is a Python script to convert a PDF file to a .docx file. It performs the following steps: Import the necessary libraries and modules, including codecs, chardet, pdfminer, and python-docx. ...
Pranav's user avatar
  • 103
0 votes
1 answer
891 views

Python utf-8 encoding not following unicode rules

Background: I've got a byte file that is encoded using unicode. However, I can't figure out the right method to get Python to decode it to a string. Sometimes is uses 1-byte ASCII text. The majority ...
krose's user avatar
  • 410
0 votes
0 answers
444 views

UTF-8 strings were wrongly decoded as UTF-16 in excel. How can I encode and decode the file so special characters display correctly?

I've received a .xlsx file where foreign language characters appear to have to have been originally encoded as utf-8 and then decoded as utf-16. I don't have access to the original file. é and ó, ...
SlugQ's user avatar
  • 141

15 30 50 per page
1
2 3 4 5
43