Skip to content

Commit 41f6e97

Browse files
committed
Fix bugs
1 parent 968b43d commit 41f6e97

2 files changed

Lines changed: 22 additions & 9 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ WORKDIR /app/
99
ADD . .
1010
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-w -s" -o /palog .
1111

12-
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:3.19
12+
FROM --platform=${TARGETPLATFORM:-linux/amd64} debian:bookworm-slim
1313
COPY --from=builder /palog /palog
1414
RUN apk add --no-cache icu
1515

main.go

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,7 @@ func init() {
4949
}
5050
}
5151

52-
func escapeString(s string) string {
53-
s = strings.ReplaceAll(s, " ", "_")
54-
55-
if !uconvLatin {
56-
return s
57-
}
58-
52+
func runUconvLatin(s string) string {
5953
var out strings.Builder
6054
cmd := exec.Command("uconv", "-x", "latin")
6155
cmd.Stdin = strings.NewReader(s)
@@ -68,7 +62,26 @@ func escapeString(s string) string {
6862
return s
6963
}
7064

71-
return strings.TrimSpace(out.String())
65+
return out.String()
66+
}
67+
68+
func escapeString(s string) string {
69+
if uconvLatin {
70+
s = runUconvLatin(s)
71+
}
72+
s = strings.ReplaceAll(s, " ", "_")
73+
s = strings.TrimSpace(s)
74+
75+
runes := []rune(s)
76+
for i := range runes {
77+
b := []byte(string(runes[i]))
78+
79+
if len(b) != 1 {
80+
runes[i] = '*'
81+
}
82+
}
83+
84+
return string(runes)
7285
}
7386

7487
func main() {

0 commit comments

Comments
 (0)