Questions tagged [cp1252]

CP-1252 or Windows-1252 is a character encoding of the Latin alphabet.

The windows 1252 codepage is used by the windows operating system to display a number of latin based languages. This character set mimics the ISO 8859-1 (Latin-1) character set, except it varies with the characters in positions in the range of 128-159.

The set of languages represented by CP1252 include English, Spanish, and various Germanic/Scandinavian languages.

125 questions
0
votes
1 answer

parse hex file and decode byte by byte

I have a hex file with extension .brt and having hex values in the range 00 - FF. I want to parse the file and print byte by byte value in the command prompt. I tried the below line of code: file = open("file.brt", encoding='utf-8') data =…
0
votes
1 answer

Linux using command file -i return wrong value charset=unknow-8bit for a windows-1252 encoded file

Using nodejs and iconv-lite to create a http response file in xml with charset windows-1252, the file -i command cannot identify it as windows-1252. Server side: r.header('Content-Disposition', 'attachment;…
user12950273
0
votes
0 answers

snscrape decode tweet in python

I'm trying to retrieve some tweets with snscrape but the JSON file generated is encoded 'cp1252'. I coulnd't find in the documentation if there is a way to request the JSON file to be encoded as I whis but, shoudn't it be possible, how can I convert…
pedro
  • 417
  • 2
  • 7
  • 25
0
votes
0 answers

Python reading a cp1252 file

I'm trying to read what is supposed to be a cp1252 file according to Sublime Text3 and I'm getting the UnicodeEncodeError. with codecs.open(config_path, mode='rb', encoding='cp1252') as f: lines = f.readlines() UnicodeEncodeError: 'charmap'…
beni
  • 105
  • 3
  • 9
0
votes
1 answer

Changing utf-8 string to cp1251 (Python)

I'm trying to convert Excel file with polish chars such as "ęśążćółń" to normal letters "esazcoln". Firstly I've menaged to convert xlsx file to txt, then: f = open("PATH_TO_TXT_FILE") r = f.read() r.upper() new_word = "" for char in r: if char…
Raqie
  • 1
0
votes
2 answers

(Python) Beautifull soup and encoding (utf-8, cp1252,ascii...)

Please help, I am so loosing nerves now.I am having this problems since I started learning Python. Always come to a same issue and no one online can give any valid answer My code: from bs4 import BeautifulSoup import requests page = requests.get( …
0
votes
1 answer

How to decode windowsCP1252 encoded string Swift

From a web service my application receiving a JSON response. In which one field is a windowsCP1252 encoded string. I am trying to decode it with following code, let input = "സൗപർണിക"//a string from server response let data =…
Johnykutty
  • 12,091
  • 13
  • 59
  • 100
0
votes
1 answer

Unfamiliar format in pdf difference array

I'm trying to decode a pdf to get the text from it, but I am having an issue using the differences arrays. The differences array I extract from the document I am working with comes in this format: 'BaseEncoding': 'WinAnsiEncoding', 'Differences':…
GriffithN
  • 1
  • 4
0
votes
1 answer

How to insert cp1252 characters using MySQLdb?

When I tried to insert right double quotes (”) using python MySQLdb it produces UnicodeEncodeError: 'latin-1' codec can't encode character u'\u201d' in position 0: ordinal not in range(256). python MySQLdb uses latin-1 codec by default and from the…
mcv
  • 45
  • 2
  • 10
0
votes
0 answers

Why does my decoded Windows-1252 string show up as a unicode value in a dictionary but not the value, although I try to decode it as UTF-8?

In my application - following Ned Batchelder's recommendations of making a unicode sandwich - I first try to decode from Windows-1252 to UTF-8: row[field] =row[field].decode('cp1252').encode('utf-8') Later on, when I want to send my data to an…
Stepharr
  • 13
  • 3
0
votes
2 answers

dagger output java (char)134 doesnt work cp1252

Normally my program should put out all CP1252 code as chars: System.out.println("actual file.encoding: "+System.getProperty("file.encoding")); // CP1252 for (int i = 0; i < 500; i++) { System.out.println("Nr.: "+i+ " Symbol:…
kelloaos
  • 41
  • 6
0
votes
0 answers

How to make Regex ignore Characters other than Cp1252 character encoding

I'm using regex to match if a string contains at least an alphabet in it. but when the string contains special characters (not in regular Cp1252 encoding) it is giving me result as not matched even when string is having other alphabets. Here is my…
0
votes
1 answer

Why is Ruby failing to convert CP-1252 to UTF-8?

I have a CSV files saved from Excel which is CP-1252/Windows-1252. I tried the following, but it still comes out corrupted. Why? csv_text = File.read(arg[:file], encoding: 'cp1252').encode('utf-8') # csv_text = File.read(arg[:file], encoding:…
Chloe
  • 25,162
  • 40
  • 190
  • 357
0
votes
2 answers

cp1252 to utf-8 using iconv for all files in a folder

I need to convert cp1252 files to UTF-8 with iconv and that worked fine for one file but when I try multiple files it's not working. i try this find . -type f -name '*.csv' -print -exec iconv -f cp1252 -t utf-8 {inputFolderPath} -o…
Malal
  • 21
  • 1
  • 1
0
votes
1 answer

What's the difference between encoding and charset? cp1252 and windows1252

What's the difference between encoding charset cp1252 and windows1252? or are they the same?
Nathan Stanford
  • 1,336
  • 3
  • 23
  • 37
1 2 3
8 9