[Home] [Downloads] [Search] [Help/forum]

Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Send text in utf8 in a trigger

Send text in utf8 in a trigger

You need to log onto the forum to reply or create new threads.

  [Refresh] Refresh page

Posted by Gunner   Argentina  (31 posts)  [Biography] bio
Date Tue 28 May 2024 08:58 PM (UTC)
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>

purpose="Translate sent text GBK into UTF-8"
date_written="2018-07-02 13:19:26"

<!-- Script -->
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


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

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?
[Go to top] top

Posted by Nick Gammon   Australia  (23,016 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Wed 29 May 2024 09:35 PM (UTC)
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
[Go to top] 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.


You need to log onto the forum to reply or create new threads.

  [Refresh] Refresh page

Go to topic:           Search the forum

[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]