forked from External/ergo
relax unicode parsing rules
NFKC was previously used for all text. Now, we use NFKC for all args but the last, which may be free text. This arg is normalized with NFC to allow for formatting characters.
This commit is contained in:
parent
4df8ec12f6
commit
6f00f89efa
3 changed files with 6 additions and 5 deletions
|
|
@ -2,6 +2,7 @@ package irc
|
|||
|
||||
import (
|
||||
"code.google.com/p/go.crypto/bcrypt"
|
||||
"code.google.com/p/go.text/unicode/norm"
|
||||
"errors"
|
||||
"fmt"
|
||||
"regexp"
|
||||
|
|
@ -99,10 +100,11 @@ var (
|
|||
func parseLine(line string) (StringCode, []string) {
|
||||
var parts []string
|
||||
if colonIndex := strings.IndexRune(line, ':'); colonIndex >= 0 {
|
||||
lastArg := line[colonIndex+len(":"):]
|
||||
line = line[:colonIndex-len(" ")]
|
||||
lastArg := norm.NFC.String(line[colonIndex+len(":"):])
|
||||
line = norm.NFKC.String(line[:colonIndex-len(" ")])
|
||||
parts = append(spacesExpr.Split(line, -1), lastArg)
|
||||
} else {
|
||||
line = norm.NFKC.String(line)
|
||||
parts = spacesExpr.Split(line, -1)
|
||||
}
|
||||
return StringCode(strings.ToUpper(parts[0])), parts[1:]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue