I've solved the two issues...I'm putting the solutions here for the benefit of anyone who comes this way again with a similar issue.
Decoding the user input has been solved with Encode as pointed out by Danny in Re^3: Yet another Encoding issue...
The apparent issue with the output from AI::Chat was that it was being fed the wrong encoding. Using the decode method from Encode at the point the chat history is pulled out of the database helped. But the problem reappeared as the chat went on. So I looked more closely at the MariaDB database encoding.
The table that stores the chat history was encoded as utf8. I changed it to utf8mb4 and suddenly all the encoding issues seem to have gone away 😊
In reply to Solved... (was: Re: Yet another Encoding issue...)
by Bod
in thread Yet another Encoding issue...
by Bod
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |