Post Reply 

Accented characters wihtin "text string" prevent script from loading

Aug 28, 2014, 04:16
Post: #1
Accented characters wihtin "text string" prevent script from loading
Hi all. New to GIMP scripting; I've been reading/playing around for a couple of hours now but I also have spent an embarrassing amount of time trying to figure this one out (at first I thought I made syntax mistakes).

In my learning efforts, I inspired myself from the tiniest demo script available online and customized it along for my own purposes. In a nutshell, when an accented character appears in a "text string" (within double quotes), a working script goes completely AWOL and does not show up upon starting the program.

Accented characters are common in the French language, and I presumed string handling was meant to be pretty robust in the second decade of the 21st century, so I was a bit baffled by this.

Does this repeat on other Win8 machines, GIMP 2.8.14? Thanks for letting me know.

OFFENDING SCRIPT (4 problematic characters present; changing é to e, à to a and û to u makes the script working again):
#!/usr/bin/env python

from gimpfu import *

# create an output function that redirects to gimp's Error Console
def gprint( text ):

# our script
def onefromtwo(image, drawable, strog, strod) :

gprint("Make one from two")
gprint("You sent me this text: "+strog)
gprint("You also sent me this text: "+strod)

# This is the plugin registration function
"Convertit deux images",
"Convertit deux images en une image",
"Sébastien à la maison",
"Août 2014",
(PF_STRING, 'string_og', 'Chemin\\fichier image 1', 'C:\\Photos\\1.jpg'),
(PF_STRING, 'string_od', 'Chemin\\fichier image 2', 'C:\\Photos\\2.jpg')

Find all posts by this user
Quote this message in a reply
Aug 28, 2014, 15:37
Post: #2
RE: Accented characters wihtin "text string" prevent script from loading
Oh, I am so grateful! Thank you for the quick response and primer tips. As you could guess I am new to Python. Also, I am unfamiliar on how external scripting is managed within an application such as GIMP so your insight was invaluable.

(Aug 28, 2014 07:08)ofnuts Wrote:  For French, use either of these:
# -*- coding: iso-8859-15 -*-
# -*- coding: utf-8 -*-
depending of course on how the file is encoded (your text editor should tell you, iso-8859-15 likely given the error message below).

Both coding schemes resolve the issue.

PF_FILENAME is exactly what I need, thanks for the suggestion. Idea
Find all posts by this user
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Script Fu top menu Dutchy 1 577 Feb 7, 2019 12:23
Last Post: paynekj
  How were these lines added between the text? KennethG 1 242 Dec 3, 2018 09:16
Last Post: paynekj
  Run script on action rchav 2 1,539 Aug 13, 2018 14:57
Last Post: rchav
  Script Fu Errors Gimp 2.10.4 lightsaber jd3481 1 1,145 Aug 2, 2018 05:13
Last Post: paynekj
  Script-fu script to conversion pdf to image 4ever 12 15,645 Jul 17, 2018 16:01
Last Post: paynekj

Forum Jump:

GIMP ForumPortalArchiveContactTermsRSS