mirror of https://github.com/fluffle/goirc
Get rid of stupid UnquoteChar usage
This commit is contained in:
parent
35351e93bb
commit
f855d74bb4
|
@ -3,7 +3,6 @@ package main
|
||||||
import (
|
import (
|
||||||
"irc"
|
"irc"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"strings"
|
"strings"
|
||||||
"http"
|
"http"
|
||||||
"json"
|
"json"
|
||||||
|
@ -105,17 +104,10 @@ func calc(conn *irc.Conn, nick *irc.Nick, args, target string) {
|
||||||
say(conn, target, "%s: Error while calculating.", nick.Nick); return
|
say(conn, target, "%s: Error while calculating.", nick.Nick); return
|
||||||
}
|
}
|
||||||
|
|
||||||
str := fmt.Sprintf("%s = %s", result[1], result[2])
|
output := fmt.Sprintf(`"%s = %s"`, result[1], result[2])
|
||||||
output := ""
|
output, err = strconv.Unquote(output)
|
||||||
// decode unicode escapes
|
if err != nil {
|
||||||
for str != "" {
|
say(conn, target, "%s: Error while decoding.", nick.Nick); return
|
||||||
var err os.Error
|
|
||||||
var rune int
|
|
||||||
rune, _, str, err = strconv.UnquoteChar(str, 0)
|
|
||||||
if err != nil {
|
|
||||||
say(conn, target, "%s: Error while decoding.", nick.Nick); return
|
|
||||||
}
|
|
||||||
output += string(rune)
|
|
||||||
}
|
}
|
||||||
output = html.UnescapeString(output)
|
output = html.UnescapeString(output)
|
||||||
say(conn, target, output)
|
say(conn, target, output)
|
||||||
|
|
Loading…
Reference in New Issue