-
Notifications
You must be signed in to change notification settings - Fork 25
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
"incorrect" locale setting causes malformed URL generation #244
Comments
Same as here in the forum but with actually useful info included, so might be able to work on it. |
So the solution will be to query the locale, and if the |
@sfrsfrsfr , can you try the attached version to see if that fixes your problem. I am pretty sure that the correct URL gets produced. I'm just a bit concerned that down the road you might end up with JSON parsing errors as that is what happened during my testing. Not totally unreasonable...the locale will influence interpreting strings as lists and numbers, too. But I'm not on Linux and the way I overruled the locale might not have been proper. Feedback appreciated! EDIT: Tried hard to get X-Plane 12 on Mac to display German numerals...in vain. My system settings are set to German all the time. Have set When you run with German numerals setting, will decimal numbers in LiveTraffic appear in German notation, e.g. in the Aircraft List or the Info Window? (From a full |
Hi TwinFan/LiveTraffic,
i can confirm your concern regarding the JSON parsing errors.
LiveTraffic: Current System time is 2022-11-05 18:28:42Z, current simulated
time is 2022-11-05 18:27:12.0Z
0:01:22,210 LiveTraffic ERROR LTOpenSky.cpp:180/ProcessFetchedData: Parsing
flight data as JSON failed
0:01:22,514 I/PLG: The plugin LiveTraffic 3.1.2 is setting global TCAS
override to 1.
0:01:33,420 E/ATC: Radio transmission required but no voice loaded!
0:01:42,123 LiveTraffic ERROR LTOpenSky.cpp:180/ProcessFetchedData: Parsing
flight data as JSON failed
See also the attached full Log.txt.
My locale settings:
locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=de_DE.UTF-8
LC_TIME=de_DE.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=de_DE.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=de_DE.UTF-8
LC_NAME=de_DE.UTF-8
LC_ADDRESS=de_DE.UTF-8
LC_TELEPHONE=de_DE.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
LC_ALL=
Thx for looking into this.
Fyi, setting LC_NUMERIC to us_US.UTF-8 in a small wrapper script works just
fine for me.
Bye, Stefan
…On Fri, Nov 4, 2022 at 11:45 PM TwinFan ***@***.***> wrote:
@sfrsfrsfr <https://github.com/sfrsfrsfr> , can you try the attached
version to see if that fixes your problem. I am pretty sure that the
correct URL gets produced. I'm just a bit concerned that down the road you
might end up with JSON parsing errors as that is what happened during my
testing. Not totally unreasonable...the locale will influence interpreting
strings as lists and numbers, too. But I'm not on Linux and the way I
overruled the locale might not have been proper.
Feedback appreciated!
LiveTraffic_3.1.2.zip
<https://github.com/TwinFan/LiveTraffic/files/9942391/LiveTraffic_3.1.2.zip>
—
Reply to this email directly, view it on GitHub
<#244 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQIPJBBY4AVMB3EG4D46UTDWGWGX7ANCNFSM6AAAAAARSE73OM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Out of curiosity I've taken a look into the Parson library I use for JSON parsing: It uses many hard-coded characters like So I've looked into thread-local locales once again, and indeed there are options. I've used this Stackoverflow suggestion now. My test on Mac (I had a debug statement in the code that set the global(!) locale to "de_DE" when loading the plugin) worked out now. All communication threads where affected, e.g. also reading the weather... With the attached new version I could finally produce German numbers in the UI while still successfully loading and parsing data (need to watch the decimal comma in the OGN line ;-) ) So, @sfrsfrsfr, please try this one: |
Hi TwinFan/LiveTraffic,
this doesn't seem to work on Ubuntu 22.04, X-Plane 12 beta 11.
It again generates OpenSky URLs with , instead of .
Log attached.
Bye, Stefan
…On Sun, Nov 6, 2022 at 12:01 AM TwinFan ***@***.***> wrote:
Out of curiosity I've taken a look into the Parson library I use for JSON
parsing: It uses many hard-coded characters like , for field separation,
as per JSON standard, and then strtod for parsing numbers, which is
locale-dependent, and that's where parsing breaks. But replacing those
strings before parsing is a sure path to peril...
So I've looked into thread-local locales once again, and indeed there are
options. I've used this Stackoverflow suggestion
<https://stackoverflow.com/a/17173977> now.
My test on Mac (I had a debug statement in the code that set the global(!)
locale to "de_DE" when loading the plugin) worked out now. All
communication threads where affected, e.g. also reading the weather...
With the attached new version I could finally produce German numbers in
the UI while still successfully loading and parsing data (need to watch the
decimal comma in the OGN line ;-) )
[image: LT_DE_Locale]
<https://user-images.githubusercontent.com/44291093/200144456-6c72260c-8d40-4054-a366-7443d33309ff.png>
So, @sfrsfrsfr <https://github.com/sfrsfrsfr>, please try this one:
LiveTraffic_3.1.2.zip
<https://github.com/TwinFan/LiveTraffic/files/9944840/LiveTraffic_3.1.2.zip>
—
Reply to this email directly, view it on GitHub
<#244 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQIPJBCEURXOXAEOYPS7FALWG3RNVANCNFSM6AAAAAARSE73OM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
:-( |
sure, it should be available now |
From your log file I see that your German locale also affects X-Plane system functions:
These are frequencies. With English format that would read I've now (for this, but also for another Linux issue) set up my own Ubuntu system, installed XP12b11 and LiveTraffic, actually a build even without the "fix" discussed here...and I can still not reproduce the issue, though with a system with English language and German regional settings I have pretty exactly the same locale as you:
What I see in X-Plane is US-formated numbers (ie. using a dot) and fully functional LiveTraffic:
I am not saying the problem doesn't exist...two individuals reported it...but I still can't get there. |
How to you actually start X-Plane? And how does your wrapper script look like. I start X-Plane from the command line like shown above:
or by double-clicking that executable in a file explorer window. |
the wrapper script "xplane.sh" is very simple:
i use i3wm and run the wrapper in a terminal |
A Windows(!) user on XP11(!) now reported something very similar: errors while parsing (here: RealTraffic) tracking data and wrong URLs for requesting data from the internet (here: weather information). See here on the Org. No feedback as of yet (but hey, it‘s Christmas) if the suggestion to change number formatting on Windows-level helped. But offers the chance for me to try on Windows, which I hadn’t done before. |
Quote from the support thread, analysis that I am suspecting another plugin the interfere with the process' locale:
|
Based on the above idea I created another plugin, with which I can switch the process locale (using |
@sfrsfrsfr, can you do me a favour a try this attached version without you setting |
i'll try the latest version real soon (today/tomorrow) and will let you
know.
I appreciate your effort on this.
…On Sat, Dec 31, 2022 at 2:36 PM TwinFan ***@***.***> wrote:
Closed #244 <#244> as
completed via b6fb7bb
<b6fb7bb>
.
—
Reply to this email directly, view it on GitHub
<#244 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQIPJBAELMP4C6H2LRBEHRDWQAZETANCNFSM6AAAAAARSE73OM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
i can confirm 3.3.0a fixed the locale issue, thx |
hello,
i was getting these errors when setting up livetraffic with an opensky account:
LiveTraffic WARN LTChannel.cpp:610/FetchAllData: OpenSky Live Online: HTTP response is not OK but 400 for https://opensky-network.org/api/states/all?lamin=49,808&lomin=8,188&lamax=50,267&lomax=8,901
Notice the , used in the coordinates
Expected behavior
No such error :-)
My Current locale setting:
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=de_DE.UTF-8
After changing LC_NUMERIC to
export LC_NUMERIC="en_US.UTF-8"
everything worked as expected
Technical Info
Suggestion: the LC_NUMERIC locale setting should not affect the URL generation used to fetch traffic data.
Thanks for a wonderful plugin!
The text was updated successfully, but these errors were encountered: