displaying the Euro

General discussions related to APLNext's Application and Commerce WebServices and WebTransfer product.

Moderators: Tech Support, phpbb_admin

displaying the Euro

Postby Chizever » March 22nd, 2021, 6:27 pm

There are some characters that display differently when I output them to file as compared to passing them to WebServices.

If I copy the Euro from CharMap to an APL+Win edit box, it displays correctly in the edit box.
If the edit box has translate=1, the character is AV[2+IO] and displays as a Euro in the APL+Win session, but not when output to file.
If the edit box has translate=0, the character is AV[128+IO] and displays as a C-cedilla in the session, but correctly as a Euro when output to a text file.
(So I use translate=0 since I'm the only one that sees the APL session and all my users see the edit box contents and the file output.)

When I return it as a WebServices result (type=document), it doesn't display correctly.
If the content-type is text/html, it's a question mark.
If the content-type is application/json, it's a question mark in a black diamond.

For JSON (which is most important to me), I can special case the Euro as \u20AC, but how many ANSI characters would I need to special case? (Euro, British Pound, a whole bunch of accented characters......).

What is the best/recommended way to handle characters which can be written to file correctly, but which WebServices seems to do some sort of translation?

Thanks,
Brian
Chizever
 
Posts: 87
Joined: March 1st, 2007, 12:12 pm

Re: displaying the Euro

Postby Davin Church » March 22nd, 2021, 7:35 pm

Have you tried messing with ⎕UCS or ⎕NFE in your test cases? Maybe converting everything to Unicode is something to think about.
Davin Church
 
Posts: 672
Joined: February 24th, 2007, 1:46 am

Re: displaying the Euro

Postby Chizever » March 23rd, 2021, 1:00 am

My app is not a UNICODE app and doesn't need to be - ASCII is fine. Since writing to a file works, WebServices must be doing some sort of translation which I don't want it to do.
I can special case the Euro, but how many other ASCII characters won't work correctly?

-Brian
Chizever
 
Posts: 87
Joined: March 1st, 2007, 12:12 pm

Re: displaying the Euro

Postby Chizever » March 23rd, 2021, 10:27 am

Hi Davin,

I looked at []UCS and I think that's what I need.
I can do everything as I am now, and then just run through []UCS just before I return it via WebServices.

Code: Select all
      json←'X-TEXT' 'UTF-8' ⎕UCS json


I'm fairly certain that UTF-8 is correct for the to_format, but I'm not sure what the from_format should be.
I've tried a bunch of them. They appear to correctly convert []AV[2], but not []AV[128] which is what I need so I can also write to file.

My current guess is that I need to also use the AV2ANSI function from the Windows workspace:
Code: Select all
      json←'X-AV.WIN' 'UTF-8' ⎕UCS AV2ANSI json


Does anyone know what the best/most reliable method would be? Are these the best specifiers for the to/from format?

Thanks to all who can help,
Brian
Chizever
 
Posts: 87
Joined: March 1st, 2007, 12:12 pm

Re: displaying the Euro

Postby Davin Church » March 23rd, 2021, 11:01 am

I haven't played with that stuff much, but it looks like you're on the right track with the AV-conversion.
Davin Church
 
Posts: 672
Joined: February 24th, 2007, 1:46 am


Return to APL WebServices

Who is online

Users browsing this forum: No registered users and 1 guest

cron