All Questions
Tagged with encoding python-3.x
672 questions
0
votes
1
answer
30
views
Parsing of CSV-File leads to "NBSP" and "SPA" Characters in Windows
I am parsing a CSV document to write a specification in SysML v2, which is essentially just a simple text file.
Parsing it on Linux I get the result I desire. I use a SysOn-Docker to display my SysML ...
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 ...
2
votes
0
answers
136
views
Failed to fetch file gs://chromium-clang-format/025ca7c75f37ef4a40f3a67d81ddd11d7d0cdb9b - Error while executing "gclient sync"
I am working on a remote machine to set up the release build for my application. We have depot_tools dependencies, so while executing the gclient sync command, we are facing some Python-related issues....
0
votes
1
answer
93
views
python `getpass.getuser()` on Windows to UTF-8
We are working with Windows computers. User names are based on real names, and so might contain accents (like, in my case 'MichaëlHooreman').
Windows machines are using CP1252 encoding. I'm using ...
0
votes
0
answers
54
views
Create two functions to encode and then decode a string using the Rail Fence Cipher
This cipher is used to encode a string by placing each character successively in a diagonal along a set of "rails". First start off moving diagonally and down. When you reach the bottom, ...
0
votes
0
answers
39
views
UTF-8 encodes single Unicode value to two different Hex values?
I am trying to encode Unicode character 192 in UTF-8 in Python as follows:
print(chr(192).encode())
Expected output:
b'\xc0'
Actual output:
b'\xc3\x80'
Where am i going wrong?
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 ...
-1
votes
1
answer
104
views
Why does b'\x30' show up as 0?
If I try to output print(b'\x30') it shows as 0. Similarly b'\x31' is displayed as 1, etc. I need this byte string (class ) to be displayed, but with ONLY one backslash.
I tried
s = br"\x30"
...
0
votes
1
answer
192
views
How to manipulate/join multiple strings containing UTF-8 characters
My code needs to be compatible with both Python 2.x and 3.x versions. I am getting both string as input to my function, and I need to do some manipulation on those:
if len(str1) > 10:
str1 = ...
0
votes
0
answers
36
views
Character encoding issue solution
While reading the data from on premises SQL server the column has collation setting in SQL server .so while reading data using AWS glue dynamic it was coming with weird value like question may I know ...
0
votes
0
answers
392
views
SAS7BDAT file read error in Python Dataframe
I am reading sas7bdat file as below into a data frame. it worked for all sas7bdat files, but failed for a new sas7bdat file today.
from sas7bdat import SAS7BDAT
with SAS7BDAT('test.sas7bdat') as m:
...
1
vote
1
answer
172
views
Reading binary signed, trailing sign integers from mainframes
I'm attempting to read what I believe is a fixed-width file into Python. Haven't typically had to deal with encoding issues before, and this one stumps me a bit.
File has no extension, I believe its ...
0
votes
1
answer
126
views
Reading Non-english text using pypdf2
I am trying to read pdf using pypdf. PDF contains non-english text here it's Hindi langauge text
pdf_file = open("/content/drive/MyDrive/DARE_Hindi_AR_2014-15-1-1.pdf", 'rb') # pdf link is ...
0
votes
1
answer
76
views
Open file in Python that the open() function cannot handle
In python, trying to open a file path that was obtained using glob.glob i suspect that the path contains characters with a different encoding to what open() can handle not sure tho. i can skip the ...
0
votes
1
answer
32
views
Python - wierd UnicodeEncodeError
I am using Python 3.6 in centos server, and I am trying to write a script outside the scope of django (though it is installed).
All the script need to do is some kind of logging, but it may have ...