cwrc / CWRC-WriterBase

The base class from which to create a CWRC-Writer XML editor.
GNU General Public License v2.0
14 stars 3 forks source link

Mixed Encodings in Request Sent to Nerve? #256

Open hzafar opened 4 years ago

hzafar commented 4 years ago

CWRC-Writer might be converting special characters (such as accents) to UTF-16 encoding within a UTF-8 document when sending a request to nerve.

Expected Behaviour

The document sent to nerve should match the encoding of the request.

Current Behaviour

This can be reproduced using the 'Sample TEI Poem' example document, which contains the string Grande Allée! Un homme!. When the Run button is clicked under the NERVE tab, in the request that is generated this is converted to Grande All\xe9e\041 Un homme\041. This is UTF-16 encoding, but the encoding of the document sent by the request is marked as UTF-8. (Full request is attached to this ticket.)

Steps to Reproduce

  1. On dev-cwrc-writer.cwrc.ca, load the Sample TEI Poem document.
  2. Open the Inspector in your browser and open the Network tab. In CWRC-Writer, under the NERVE tab, click Run.
  3. Copy the POST request in Inspector and check the request data. It will contain strings in mixed encodings.

Your Environment

cc: @ilovan

lucaju commented 4 years ago

I can't seem to reproduce the problem,

The referenced portion has been sent as Grande Allée\u0021 Un homme\u0021. \u0021 is UTF-8 to exclamation marks (!), I believe.

Environment URL: dev-cwrc-writer.cwrc.ca (also test at cwrc-writer.cwrc.ca and my localhost environment) Browser Name: Chrome Operating System: macOS Attachements: https://app.zenhub.com/files/82123127/94457327-0429-4dd0-9ed4-6b1a4ebe8e35/download

lucaju commented 4 years ago

Wait. It might be a browser-specific problem.

Environment URL: dev-cwrc-writer.cwrc.ca Browser Name: Firefox and Safari Operating System: macOS

Attachments: https://app.zenhub.com/files/82123127/179f03e5-ee5b-4c72-891b-08536674a253/download https://app.zenhub.com/files/82123127/edf89e6a-3f5f-487d-b342-82ee7fde9b38/download

lucaju commented 4 years ago

FYI,

if on step 3:

  1. Copy the POST request in Inspector and check the request data. It will contain strings in mixed encodings. the data is copied as Fetch, the encoding seems to be normal. We use Fetch on the browser to submit the data.

Environment URL: dev-cwrc-writer.cwrc.ca Browser Name: Firefox Operating System: macOS

Attachments: https://app.zenhub.com/files/82123127/578dd945-b6a0-48b5-8b69-a835b7727f1f/download

ilovan commented 4 years ago

@hzafar , can you please review and reply?

hzafar commented 4 years ago

@lucaju @ilovan sounds like this might have been a one-off issue when I was testing, then :). If we see the error on the nerve server again, I'll revisit, but I'm okay with closing this for now?