Translate sent text GBK(or other charsets) into UTF-8

Posted by Lost on Thu 05 Jul 2018 12:22 PM — 2 posts, 13,531 views.

China #0
I wrote a plugin to convert sent text charset(GBK to UTF-8), you can manually change "GBK" to other charset.


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>

<muclient>
<plugin
   name="Translate_GBK_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", "GBK")
    local nstr, err = cd:iconv(sText)
    Send ((nstr))
    return false
end -- OnPluginSend
]]>
</script>

</muclient>


The plugin require libiconv2.dll and luaiconv.dll, you can download from:

https://www.dropbox.com/s/a90e4shr41q3wi5/luaiconv.zip?dl=0
USA Global Moderator #1
Thanks!