Source convert to UTF8

Feature requests for future versions of Hollywood can be voiced here
Post Reply
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Source convert to UTF8

Post by lazi »

As a poor Amiga wannabe coder it is hard to create scripts containing UTF8 encoding strings as there is no editor for it.
Maybe we should stick on latin-1 scripts and use UTF8 localization if needed, but sometimes it just make live harder.
Thanks for Hollywood's rich features I already made an UTF8 aware text editor which gives me some possibility, but it will never be a CubicIDE.
I am using it for converting the script and 'postproduction' :)

Playing with thoughts, a possible solution emerged which we may discuss further.
What if Hollywood offer a console argument to enable compile time encoding conversion. If I write my script with the prefs codepage but wanted to be an UTF8 encoded script Hollywood may do the conversion before the compiling leave the source script intact.
It could use the same functionality as it would be with ConvertStr(<source>,#encoding_amiga,#encoding_utf8).

Is it make some sense?
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Source convert to UTF8

Post by airsoftsoftwair »

lazi wrote: Wed May 20, 2020 10:22 pm As a poor Amiga wannabe coder it is hard to create scripts containing UTF8 encoding strings as there is no editor for it.
On MorphOS there is FlowStudio that supports UTF-8.
lazi wrote: Wed May 20, 2020 10:22 pm Maybe we should stick on latin-1 scripts and use UTF8 localization if needed, but sometimes it just make live harder.
Thanks for Hollywood's rich features I already made an UTF8 aware text editor which gives me some possibility, but it will never be a CubicIDE.
I am using it for converting the script and 'postproduction' :)

Playing with thoughts, a possible solution emerged which we may discuss further.
What if Hollywood offer a console argument to enable compile time encoding conversion. If I write my script with the prefs codepage but wanted to be an UTF8 encoded script Hollywood may do the conversion before the compiling leave the source script intact.
It could use the same functionality as it would be with ConvertStr(<source>,#encoding_amiga,#encoding_utf8).
Is it make some sense?
Yes, but I think this is already supported. When Hollywood loads a script and detects invalid UTF-8 characters in it, it will automatically assume that the file is in the system's default encoding and convert it to UTF-8. So I think you can just pass your script in the system encoding to Hollywood and Hollywood will convert it to UTF-8 automagically. Try it :)
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Re: Source convert to UTF8

Post by lazi »

airsoftsoftwair wrote: Thu May 21, 2020 12:07 pm So I think you can just pass your script in the system encoding to Hollywood and Hollywood will convert it to UTF-8 automagically. Try it :)
Ahh, yes. And I already knew it. But the problem that arised made my fuzzy logic :)

It is on OS4 with Cubic IDE, so no UTF8, and ISO-8859-16 locale codepage.

When I use this command:

Code: Select all

x = SystemRequest("Szamlazz","Számla elkészitése!","Adatküldés|Mégsem") 
Everything is ok.
Image

But when the command is executed from an included script, something changes on UTF8 conversion.

unnamed.hws:

Code: Select all

Function p_1()
	x = SystemRequest("Szamlazz","Számla elkészitése!","Adatküldés|Mégsem")
EndFunction     
main.hws:

Code: Select all

@INCLUDE "unnamed.hws"
p_1
WaitLeftMouse            
Here is the result:
Image
The strings are converted to UTF-8, and it makes the system requester mad, the button separator is missed.
It seems that the UTF8 encoded character displays as a question mark and the next two characters are going to nil:

As this is the wishlist, I just wish an explanation. :)
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Source convert to UTF8

Post by airsoftsoftwair »

lazi wrote: Thu May 21, 2020 10:49 pm As this is the wishlist, I just wish an explanation. :)
Looks like a bug to me. Apparently, automatic conversion doesn't occur for included files...
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Source convert to UTF8

Post by airsoftsoftwair »

Code: Select all

- Fix: Scripts included via the @INCLUDE preprocessor command weren't automatically converted to UTF-8 in
  case they used some different encoding
Post Reply