Skip to content

Instantly share code, notes, and snippets.

@lostsnow
Last active July 2, 2018 06:36
Show Gist options
  • Save lostsnow/9283dcf0481dc6c6a0e5885586592712 to your computer and use it in GitHub Desktop.
Save lostsnow/9283dcf0481dc6c6a0e5885586592712 to your computer and use it in GitHub Desktop.
Translate sent text GBK into UTF-8
<?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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment