Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apostrophes in Weather Alert info #97

Closed
neilswann80 opened this issue Nov 2, 2024 · 10 comments
Closed

Apostrophes in Weather Alert info #97

neilswann80 opened this issue Nov 2, 2024 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@neilswann80
Copy link

neilswann80 commented Nov 2, 2024

Apostrophes in Weather Alert info cause an issue, displayig as: â€tm

See example below:

@orontee orontee added the bug Something isn't working label Nov 2, 2024
@orontee orontee added this to the Next release milestone Nov 2, 2024
@orontee
Copy link
Owner

orontee commented Nov 2, 2024

Thank you for reporting!

Can you attach the /mnt/ext1/system/state/taranis.json file? It contains the application model serialized in JSON. It will help to reproduce and analyze the problem.

@orontee orontee self-assigned this Nov 2, 2024
@neilswann80
Copy link
Author

Thank you for reporting!

Can you attach the /mnt/ext1/system/state/taranis.json file? It contains the application model serialized in JSON. It will help to reproduce and analyze the problem.

I'm not getting any weather alerts currently, so will the JSON still help? I've had the screenshot saved for a while.

@orontee
Copy link
Owner

orontee commented Nov 2, 2024

Don't worry, I'll try to reproduce by myself.

@orontee
Copy link
Owner

orontee commented Nov 13, 2024

Tested with various Unicode characters in alert description (writing the characters directly in the taranis.json file) and it's ok; The following text was rendered as expected:

It's an apostrophe, it’s a right single quotation mark, it‘s a left single quotation mark! À aussi en français accentuons le débat.

One can thus expect that the content of the state file is wrongly encoded when the problem happens. Can come from a wrong deserialization of the OpenWeather API response or a wrong encoding while writing the state file.

@orontee orontee removed this from the Next release milestone Nov 20, 2024
@orontee
Copy link
Owner

orontee commented Nov 20, 2024

I failed to reproduce up to now. Please post the location and taranis.json file if the problem appears once again.

@neilswann80
Copy link
Author

neilswann80 commented Nov 22, 2024

It's happening for today's weather alert for Bistol, GB.

taranis.json

Also the last line of the alert is partly cut-off (I've noticed this on the last couple of alerts):

@orontee
Copy link
Owner

orontee commented Nov 22, 2024

Great! Reproduced on my device. I'll investigate after work. Thank you!

@orontee
Copy link
Owner

orontee commented Nov 22, 2024

From the logs I read the URL requested.

Then I checked that the response headers says that the encoding used is UTF-8 but the payload is wrongly encoded since terminal support UTF-8 and display of response payload is wrong:

matthias@peitho:~ $ curl --verbose --output payload_with_wrong_accents.json "https://api.openweathermap.org/data/3.0/onecall?lon=-2.5973&lat=51.453802199999998&units=metric&exclude=minutely&lang=fr&appid=4620ad6f20069b66bc36b1e88ceb4541" 2>&1 | grep -E charset
< Content-Type: application/json; charset=utf-8
matthias@peitho:~ $ cat payload_with_wrong_accents.json | grep --only-matching -E "It.*easy"
It’s easy
matthias@peitho:~ $ echo -e '\xe2\x82\xac'   # Print euro sign to check whether terminal supports UTF-8 encoding
€

Requesting a specific charset is a no-op:

curl --verbose -H "Accept-Charset: iso8859-1" --output payload_with_wrong_accents.json "https://api.openweathermap.org/data/3.0/onecall?lon=-2.5973&lat=51.453802199999998&units=metric&exclude=minutely&lang=fr&appid=4620ad6f20069b66bc36b1e88ceb4541" 2>&1 | grep -iE charset
> Accept-Charset: iso8859-1
< Content-Type: application/json; charset=utf-8

And finally, on OpenWeather website itself:

image

Conclusion: Not a Taranis bug! More an OpenWeather API or Met Office bug.

@orontee orontee closed this as completed Nov 22, 2024
@neilswann80
Copy link
Author

Although not a Taranis issue then, would it be worth adding a workaround to substitute "â€tm" for an apostrophe anyway?

And what about the last line of the alert being cut off? Does that need raising as a separate issue?

Thanks.

@orontee
Copy link
Owner

orontee commented Nov 23, 2024

Although not a Taranis issue then, would it be worth adding a workaround to substitute "â€tm" for an apostrophe anyway?

My point of view is that we'd better first send a bug report upstream (OpenWeather API) and see whether they work on it or not. Open for discussion.

And what about the last line of the alert being cut off? Does that need raising as a separate issue?

Good catch! There's a bug in the computation of the content height of alert description; It's not possible to scroll to read full content... Tracked with #100.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants