Server Connect Text to Image advice

I have a form which runs a server action, the action has a Text to Image ste in it.

If i ask it to create this text: BOTSWANA & ZIMBABWE WILDLIFE ODYSSEY
It throws the following error

{
    "status": "500",
    "message": "Input buffer has corrupt header: glib: XML parse error: Error domain 1 code 68 on line 11 column 82 of data: xmlParseEntityRef: no name",
    "stack": "Error: Input buffer has corrupt header: glib: XML parse error: Error domain 1 code 68 on line 11 column 82 of data: xmlParseEntityRef: no name"
}

If i change the text to: BOTSWANA AND ZIMBABWE WILDLIFE ODYSSEY
It works, so it does not like the & ampersand symbol, I also tried changing it to & which also does not work.

Any ideas on how i can get this to work including special characters, considering I am unsure what people may possibly type in there? @Teodor would you mind testing possibly if this is a bug or just me.

Not sure if that will help, but can you try applying the encodeurl formatter on the POST value in your server action, where you pass its value to the text-to-image?

Thanks Teo, tried that, unfortunately I get the same error which is kind of even more strange to be honest because how does it know %26 is the & symbol if it is not decoding the input.
Original Text: BOTSWANA & ZIMBABWE WILDLIFE ODYSSEY
URL Encoded: BOTSWANA%20%26%20ZIMBABWE%20WILDLIFE%20ODYSSEY
Error is:

{
    "status": "500",
    "message": "Input buffer has corrupt header: glib: XML parse error: Error domain 1 code 68 on line 11 column 84 of data: xmlParseEntityRef: no name",
    "stack": "Error: Input buffer has corrupt header: glib: XML parse error: Error domain 1 code 68 on line 11 column 84 of data: xmlParseEntityRef: no name"
}

And if I change the ampersand to the actual word AND then i get this result without any error.
Original Text: BOTSWANA AND ZIMBABWE WILDLIFE ODYSSEY
URL Encoded: BOTSWANA%20AND%20ZIMBABWE%20WILDLIFE%20ODYSSEY

Output is

Just a strange update, it accepts other characters, such as É so it seems like it just really does not like ampersand symbols, for now I am just using the_text.replace('&','and') to work around this.

You should create a bug report, errors like these are bugs until proven otherwise :wink:

1 Like

Possibly it is seeing everything after the & as a parameter rather than part of the string?

Can it cope with the "?" character?

1 Like

Just tested, and ? character seems ok, strange indeed.

Which server model do you use (NodeJS, PHP or ASP.NET)?

After a google search for the exact error message it seems probably an issue with the sharp library in NodeJS.

So I updated the code to correctly encode the text, please test the following update

image.zip (3.1 KB) Unzip to lib/modules.

1 Like

Amazing Patrick, thank you so much, it works perfectly now, so happy, here is the happy result

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.

Fixed in Wappler 7.0.0 Beta 29