1. Sverre Tvedt
  2. PowerBuilder
  3. Monday, 14 October 2019 17:14 PM UTC

PB 2017 R3

I'm consuming a third party REST service using httpclient and when parsing the returned JSON-string I do it with JsonParser.

The number values in the returned JSON string are always supplied with a dot (".") for decimal point. It seems like JsonParser.getitemnumber fails if the region setting for decimal point is "," or anything else than ".". Is this intended?  How can I get around it? I cannot control the local number format settings of the users' PCs.

Accepted Answer
Michael Kramer Accepted Answer Pending Moderation
  1. Monday, 14 October 2019 18:28 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi Sverre, Ouch!

This seems like adhering to regional settings is implemented a place too many! JSON for certain has its own standard format where decimal point is a point. This has to be fixed so please log it as a bug. Note in the bug description that it does not conform to JSON standard. That hopefully bumps up priority.

Me, a Dane working in Netherlands, Germany, and Switzerland - all having decimal comma in common. I hear you loud and clear.

At least you don't use Hungarian settings. Grouping character is neither comma, nor point - it is space!

HTH /Michael

Comment
  1. Sverre Tvedt
  2. Tuesday, 15 October 2019 08:38 AM UTC
Actually, it may have been my fault. After messing around with the regional settings, it started working according to specifications for both comma and point in regional settings. The error most likely go back to some other problem outside PB.
  1. Helpful
  1. Michael Kramer
  2. Tuesday, 15 October 2019 09:06 AM UTC
No problem. Good you found how to avoid the issue -- and you don't need to await future PB bug fix.

Creating simple test case often helped me identify bug in my own code.

TIP on regional settings: User PC may have different settings than app's database. So ORDER BY in DataWindow's SELECT may sort data different than sort criteria in the DataWindow object. EX: In Danish "AAA" sorts after "ZZZ".
  1. Helpful
There are no comments made yet.
Sverre Tvedt Accepted Answer Pending Moderation
  1. Wednesday, 16 October 2019 08:02 AM UTC
  2. PowerBuilder
  3. # 1

Ken, see my comments above. The Json string always arrive formatted with "." as decimal pont. It is possible that the problem was caused by both the grouping character and decimal point set to ",", an instance of poor group policy in our Windows domain. By going back and forth with various regional settings, I  ended up being unable to reproduce the problem :) Visit the physician, and the symptoms disappear ...

Comment
There are no comments made yet.
Ken Guo @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 16 October 2019 03:10 AM UTC
  2. PowerBuilder
  3. # 2

Hi Sverre

 

Could you please tell me what JSON string did you retrieve from REST if you configure the decimal point to ‘,’ in the region setting?

And what JSON string did you retrieve from REST if you configure the decimal point to ‘.’ in the region setting?

 

Regards,

Ken

 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.