skip to Main Content

Can I revert bad encoding with javascript

I need to fix the encoding of some web-data with javascript. I have no control of how the data is produced but this is basically what is happening: (new TextDecoder('latin1')).decode((new TextEncoder()).encode('å')) 'Ã¥' So at the moment the page displays Ã¥…

VIEW QUESTION

How to encode Python Decimal to Json Number

How to convert Decimal("123456789012345.99") to json number 123456789012345.99? Python 3.11 win64 import json from decimal import Decimal class DecimalToFloat(json.JSONEncoder): def default(self, obj): if isinstance(obj, Decimal): return float(obj) return json.JSONEncoder.default(self, obj) class DecimalToStr(json.JSONEncoder): def default(self, obj): if isinstance(obj, Decimal): return str(obj)…

VIEW QUESTION
Back To Top
Search