titaniumnetwork-dev / Ultraviolet-Node-Archive

Highly sophisticated proxy used for evading internet censorship or accessing websites in a controlled sandbox using the power of service-workers and more! Easy deployment version (Node.js)
https://ultravioletsw.dev
73 stars 910 forks source link

Incorrect windows-1251 handling #54

Open zuev-stepan opened 1 year ago

zuev-stepan commented 1 year ago

Sites encoded with windows-1251 are not rendered correctly.

Expected Behavior

Site should look just like it does without proxy.

Current Behavior

Non-ascii characters are replaced with mess (пїЅпїЅпїЅ).

Possible Solution

Instead of taking response.text(), you should decode it considering charset from headers and also update headers accordingly.

Steps to Reproduce

open rutracker.org

Context (Environment)

Detailed Description

Possible Implementation

I made a simple fix which works for rutracker, but you probably have to implement a better solution to work everywhere (https://github.com/zuev-stepan/Ultraviolet-Static/commit/551b5381e3c6a514d857d297bc27a779e53c7b4c)