ATARIST encoding for linux iconv

GFA, ASM, STOS, ...

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

Post Reply
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3270
Joined: Sun Aug 03, 2014 5:54 pm

ATARIST encoding for linux iconv

Post by ThorstenOtto »

Almost forgot this, but a few weeks ago i hacked together a gconv module for iconv. iconv is the tool on linux that can convert between lots of character encoding. However atarist (although present in the iconv source distribution) is usually not compiled in. Furthermore, on linux based system, the core of iconv is part of the glibc, so recompiling iconv yourself does not help. Luckily, the implementation in glibc uses gconv shared modules to load character sets on demand, and here is the one for atarist encoding. Instructions are contained in the archive. Maybe someone will find this useful.

PS.: the compiled module is for 64bit systems only.
You do not have the required permissions to view the files attached to this post.
User avatar
mfro
Atari God
Atari God
Posts: 1292
Joined: Thu Aug 02, 2012 10:33 am
Location: SW Germany

Re: ATARIST encoding for linux iconv

Post by mfro »

As an additional hint that might not be obvious to everybody (that I, personally, find extremly useful, however): when cross compiling, this can be used to convert strings during compilation.

m68k-atari-mint-gcc has the option "-fexec-charset" that allows you to translate compiled string constants written in the default charset of your host (e.g. UTF8, standard on Linux) into the Atari target charset on the fly.

I.e., if you have a .c file with string constants

Code: Select all

const char str[] = "characters: äöüß";
written in UTF8, characters will be automatically converted into the Atari charset with the option "-fexec-charset=ATARI". On the Atari, "magically", the correct "special characters" will appear at runtime. This option makes use of Thorsten's iconv module.

No more fiddling with hex constants in strings, no accidents with git or modern editors anymore. Thanks, Thorsten!
ragnar76
Captain Atari
Captain Atari
Posts: 427
Joined: Thu Apr 07, 2011 3:01 pm

Re: ATARIST encoding for linux iconv

Post by ragnar76 »

Works like a charm but in Linux Mint 20.2 and Debian 10 i had to copy it to /usr/lib/x86_64-linux-gnu/gconv/ to get it to work. There is also the gconv-modules
• FireBee • Falcon030/040/060 • MiSTer • TT • (Mega)STe • Suska III-B • Suska III-C • (Mega)ST •
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3270
Joined: Sun Aug 03, 2014 5:54 pm

Re: ATARIST encoding for linux iconv

Post by ThorstenOtto »

Yes, sorry, other distributions might have different directories where the modules are stored. If in doubt, just do a

Code: Select all

$ sudo find /usr -name gconv-modules
Edit: forgot to mention: that file is most likely been overwritten if glibc is updated, so you may have to redo the install steps after that,
ragnar76
Captain Atari
Captain Atari
Posts: 427
Joined: Thu Apr 07, 2011 3:01 pm

Re: ATARIST encoding for linux iconv

Post by ragnar76 »

in best cases, apt will ask you if it is okay to overwrite the changes
• FireBee • Falcon030/040/060 • MiSTer • TT • (Mega)STe • Suska III-B • Suska III-C • (Mega)ST •
User avatar
Eero Tamminen
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3838
Joined: Sun Jul 31, 2011 1:11 pm

Re: ATARIST encoding for linux iconv

Post by Eero Tamminen »

mfro wrote: Mon Jul 19, 2021 12:57 pm I.e., if you have a .c file with string constants written in UTF8, characters will be automatically converted into the Atari charset with the option "-fexec-charset=ATARI". On the Atari, "magically", the correct "special characters" will appear at runtime. This option makes use of Thorsten's iconv module.
Thanks, this is really useful!
User avatar
alexh
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3084
Joined: Wed Oct 20, 2004 1:52 pm
Location: UK - Oxford
Contact:

Re: ATARIST encoding for linux iconv

Post by alexh »

Thanks. This was used to convert the Amberstar source code that was released yesterday
User avatar
saulot
Captain Atari
Captain Atari
Posts: 441
Joined: Sat Sep 18, 2004 9:09 pm
Location: Warszawa
Contact:

Re: ATARIST encoding for linux iconv

Post by saulot »

alexh: I've just seen the repo (https://github.com/jhorneman/amberstar), that's awesome..
User avatar
Cyprian
10 GOTO 10
10 GOTO 10
Posts: 3226
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: ATARIST encoding for linux iconv

Post by Cyprian »

Lynx I / Mega ST 1 / 7800 / Portfolio / Lynx II / Jaguar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
DDD HDD / AT Speed C16 / TF536 / SDrive / PAK68/3 / Lynx Multi Card / LDW Super 2000 / XCA12 / SkunkBoard / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Steem SSE / Aranym / Saint
http://260ste.atari.org
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3270
Joined: Sun Aug 03, 2014 5:54 pm

Re: ATARIST encoding for linux iconv

Post by ThorstenOtto »

You should better make an announcement for this. People searching info about amberstar/ambermoon will certainly not look into a thread talking about iconv ;)
User avatar
Cyprian
10 GOTO 10
10 GOTO 10
Posts: 3226
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: ATARIST encoding for linux iconv

Post by Cyprian »

ThorstenOtto wrote: Tue May 09, 2023 12:53 pm You should better make an announcement for this. People searching info about amberstar/ambermoon will certainly not look into a thread talking about iconv ;)
it was announced today. I have seen a someone post here on AF , but now I'm not able to find it. Maybe it was removed/deleted.
Lynx I / Mega ST 1 / 7800 / Portfolio / Lynx II / Jaguar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
DDD HDD / AT Speed C16 / TF536 / SDrive / PAK68/3 / Lynx Multi Card / LDW Super 2000 / XCA12 / SkunkBoard / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Steem SSE / Aranym / Saint
http://260ste.atari.org
Post Reply

Return to “Coding”