Page 1 of 1
Source convert to UTF8
Posted: Wed May 20, 2020 10:22 pm
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?
Re: Source convert to UTF8
Posted: Thu May 21, 2020 12:07 pm
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

Re: Source convert to UTF8
Posted: Thu May 21, 2020 10:49 pm
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.
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:

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.

Re: Source convert to UTF8
Posted: Sat May 23, 2020 11:51 am
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...
Re: Source convert to UTF8
Posted: Sat Sep 05, 2020 6:35 pm
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