push unicode update

This commit is contained in:
merith-tk 2024-11-03 12:57:22 -08:00
parent 5c2cfc7275
commit eb9cd40ec6
3 changed files with 19 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
mods
disabled

View file

@ -64,7 +64,9 @@ func main() {
// read the mod.json file and return the name, version, and filename
name, version, loader := readMod("./mods/" + file.Name())
name = cleanUnicode(name)
name = cleanPattern.ReplaceAllString(name, "")
if loader != "" {
err := os.Rename("./mods/"+file.Name(), "./mods/"+name+"-"+version+".jar")
if err != nil {

15
unicode.go Normal file
View file

@ -0,0 +1,15 @@
package main
import (
"fmt"
"strings"
)
func cleanUnicode(s string) string {
for _, r := range s {
if r > 127 {
s = strings.ReplaceAll(s, string(r), fmt.Sprintf("&#%d;", r))
}
}
return s
}