Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ General ➜ Send text in utf8 in a trigger

Send text in utf8 in a trigger

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Gunner   Argentina  (31 posts)  Bio
Date Tue 28 May 2024 08:58 PM (UTC)
Message
Hello,
I'm playing a mud whose encoding is utf8.
I have checked this checkbox in the output settings "UTF-8 (Unicode)".
Also, I use this plugin to send text in utf8:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>

<muclient>
<plugin
name="Translate_ISO_TO_UTF8"
author="lostsnow"
id="b5d6c2e22177e7a13b081a29"
language="Lua"
purpose="Translate sent text GBK into UTF-8"
date_written="2018-07-02 13:19:26"
requires="4.25"
version="1.0"
>
</plugin>

<!-- Script -->
<script>
<![CDATA[
function OnPluginSend (sText)
assert (package.loadlib ("luaiconv.dll", "luaopen_iconv")) ()
local cd = iconv.open("UTF-8", "ISO-8859-1")
local nstr, err = cd:iconv(sText)
Send ((nstr))
return false
end -- OnPluginSend
]]>
</script>

</muclient>

But when I create a trigger and use the Note() function to send text with special characters, it looks bad:
<triggers>
<trigger
enabled="y"
group="Quest"
match="El Dios Probador te cuenta 'Busca * en el area de *!'"
omit_from_log="y"
omit_from_output="y"
send_to="14"
sequence="99"
>
<send>Note("Busca el objeto en %1, área %2")
Execute("history_add questman=Busca el objeto en %1, área %2")</send>
</trigger>
</triggers>

But when the trigger is triggered, the accent on the á of the word área is not displayed correctly.
How can I make the text I sent through the Note() function be sent in utf8?
thanks
Top

Posted by Nick Gammon   Australia  (23,057 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 29 May 2024 09:35 PM (UTC)
Message
It appears that Note (or print) does not expect UTF8 characters.

You can try:


Note (utils.utf8convert ("Busca el objeto en %1, área %2"))


I doubt that would work for Unicode characters with a code number > 255.

For those characters (if you have them) you might need to convert them like this:


Note (utils.utf8encode (282))  -- Ě


This is a bit of a work-around, I'll see if we can improve the way Note works.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


1,191 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.