RSS/Atom feed Twitter
Site is read-only, email is disabled

Script-fu (Scheme) and UTF-8 literals

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

8 of 8 messages available
Toggle history

Please log in to manage your subscriptions.

Script-fu (Scheme) and UTF-8 literals Jonathan Dearborn 14 May 15:05
  Script-fu (Scheme) and UTF-8 literals Torsten Neuer 14 May 16:28
   Script-fu (Scheme) and UTF-8 literals Jonathan Dearborn 14 May 18:14
    Script-fu (Scheme) and UTF-8 literals Sven Neumann 15 May 10:11
    Script-fu (Scheme) and UTF-8 literals Torsten Neuer 15 May 10:46
     Script-fu (Scheme) and UTF-8 literals Jonathan Dearborn 16 May 16:24
      Script-fu (Scheme) and UTF-8 literals Torsten Neuer 16 May 18:31
       Script-fu (Scheme) and UTF-8 literals Jonathan Dearborn 17 May 22:42
Jonathan Dearborn
2008-05-14 15:05:41 UTC (almost 16 years ago)

Script-fu (Scheme) and UTF-8 literals

Hey,

I've been having trouble finding how to encode UTF-8 special characters into a string literal in Script-fu. Could someone provide an example of how to hard-code international characters into a string? Specifically, I'm trying to put ascii codes 161 - 255 into a string with each character separated by a space.

Thanks, Jonny D

__________________

Torsten Neuer
2008-05-14 16:28:25 UTC (almost 16 years ago)

Script-fu (Scheme) and UTF-8 literals

Hello,

I've been having trouble finding how to encode UTF-8 special characters into a string literal in Script-fu. Could someone provide an example of how to hard-code international characters into a string?

The simplest and easiest way is to use a text editor that is capable of switching text encoding. One of those editors would be Emacs, which is also available on many platforms (from the menu select: Options -> Mule -> Set Language Environment -> UTF-8).

Torsten

Jonathan Dearborn
2008-05-14 18:14:14 UTC (almost 16 years ago)

Script-fu (Scheme) and UTF-8 literals

Do you mean just type them in? That isn't working for me. Wouldn't switching the encoding affect the whole file instead of just a particular string? I'm on WinXP, just using Notepad, which can handle the ascii values I'm using (I was surprised that Dr. Scheme can't, however). Typing them into a string isn't working. I've tried escaping them and using the hex value with \x, but that didn't seem to fly with Script-fu. 'format' isn't available either. The Gimp 2.4 supposedly supports these characters, but I just haven't seen the documentation to back it up. Is there another way that you know of?

Thanks for your help, Jonny D

From: tneuer@inwise.de
To: gimp-user@lists.xcf.berkeley.edu Date: Wed, 14 May 2008 16:28:25 +0200 Subject: Re: [Gimp-user] Script-fu (Scheme) and UTF-8 literals

Hello,

I've been having trouble finding how to encode UTF-8 special characters into a string literal in Script-fu. Could someone provide an example of how to hard-code international characters into a string?

The simplest and easiest way is to use a text editor that is capable of switching text encoding. One of those editors would be Emacs, which is also available on many platforms (from the menu select: Options -> Mule -> Set Language Environment -> UTF-8).

Torsten

__________________

Sven Neumann
2008-05-15 10:11:04 UTC (almost 16 years ago)

Script-fu (Scheme) and UTF-8 literals

Hi,

just use a proper editor. Emacs is available for free and it supports UTF-8 and syntax highlighting for the Scheme language.

Sven

Torsten Neuer
2008-05-15 10:46:41 UTC (almost 16 years ago)

Script-fu (Scheme) and UTF-8 literals

Hi,

Do you mean just type them in?

Yes.

That isn't working for me. Wouldn't switching the encoding affect the whole file instead of just a particular string?

That should do no harm as Gimp is doing about everything in UTF-8 internally. Plus, any characters that are relevant to Scheme syntax (i.e. not "strings") are from 7-bit ASCII and won't be touched anyway when you switch to UTF-8.

I'm on WinXP, just using Notepad, which can handle the ascii values I'm using (I was surprised that Dr. Scheme can't, however).

Strictly speaking, the values that you are talking about are not ASCII (as that only defines 7 bits originally - the upper 127 characters depend on which locale you are in and might even be text graphics).

Notepad also stores its data in an encoding, which however is not UTF-8.

Typing them into a string isn't working.

Hmm... have you tried using the ALT- for entering the values ? You seem to know the encoding values of the characters in UTF-8, so this might work then with Notepad.

Torsten

Jonathan Dearborn
2008-05-16 16:24:39 UTC (almost 16 years ago)

Script-fu (Scheme) and UTF-8 literals

I'm still not able to get this to work. Attached is my script (or find it at http://pubpages.unh.edu/~jmb97/SDL/NFont/render-nfont.scm). It produces a bitmap of the characters in a font. I thought the whole first byte was identical between ASCII and UTF-8... Anyhow, maybe someone can get it to work or see what I'm trying to do. Basically, I'm just trying to put the special and accented characters (161, '¡' to 255, ÿ) into a string, but the Gimp isn't outputting anything where they should be. The script appears as NFont->Create NFont. Then you must check the extended ASCII box. I tried using Emacs, but changing the encoding didn't affect anything.

Thanks, Jonny D

From: tneuer@inwise.de
To: gimp-user@lists.xcf.berkeley.edu Subject: Re: [Gimp-user] Script-fu (Scheme) and UTF-8 literals Date: Thu, 15 May 2008 10:46:41 +0200 CC: grimfang4@hotmail.com

Hi,

Do you mean just type them in?

Yes.

That isn't working for me. Wouldn't switching the encoding affect the whole file instead of just a particular string?

That should do no harm as Gimp is doing about everything in UTF-8 internally. Plus, any characters that are relevant to Scheme syntax (i.e. not "strings") are from 7-bit ASCII and won't be touched anyway when you switch to UTF-8.

I'm on WinXP, just using Notepad, which can handle the ascii values I'm using (I was surprised that Dr. Scheme can't, however).

Strictly speaking, the values that you are talking about are not ASCII (as that only defines 7 bits originally - the upper 127 characters depend on which locale you are in and might even be text graphics).

Notepad also stores its data in an encoding, which however is not UTF-8.

Typing them into a string isn't working.

Hmm... have you tried using the ALT- for entering the values ? You seem to know the encoding values of the characters in UTF-8, so this might work then with Notepad.

Torsten

__________________

Torsten Neuer
2008-05-16 18:31:20 UTC (almost 16 years ago)

Script-fu (Scheme) and UTF-8 literals

Hi,

I tried using Emacs, but changing the encoding didn't affect anything.

Just loading the file, changing the encoding and saving it again won't do anything. The encoding switches are meant for newly entered text.

That means that you will have to re-enter the characters with the UTF-8 encoding switched on.

Torsten

Jonathan Dearborn
2008-05-17 22:42:53 UTC (almost 16 years ago)

Script-fu (Scheme) and UTF-8 literals

Thanks for all of your help, Torsten. I got it figured out. Emacs wasn't very pleasant, but it led me to see what I needed to do. I checked the binary representations of the characters at www.fileformat.info and used the two characters they represent to make each one I needed. For anyone who would like to see what it ended up looking like, check out http://pubpages.unh.edu/~jmb97/SDL/NFont/render-nfont.scm Maybe it would have been easier to write a C++ program that outputs a string to a file, since the unicode escape (\u00A1, for example) is really simple. Anyhow, it's done.

Thanks again, Jonny D

From: tneuer@inwise.de
To: gimp-user@lists.xcf.berkeley.edu Subject: Re: [Gimp-user] Script-fu (Scheme) and UTF-8 literals Date: Fri, 16 May 2008 18:31:20 +0200 CC: grimfang4@hotmail.com

Hi,

I tried using Emacs, but changing the encoding didn't affect anything.

Just loading the file, changing the encoding and saving it again won't do anything. The encoding switches are meant for newly entered text.

That means that you will have to re-enter the characters with the UTF-8 encoding switched on.

Torsten

__________________