ae130dc500
Signed-off-by: Michael Mayer <michael@photoprism.app>
21 lines
266 B
Go
21 lines
266 B
Go
package clean
|
|
|
|
import "strings"
|
|
|
|
// Unicode returns a string a valid unicode.
|
|
func Unicode(s string) string {
|
|
if s == "" {
|
|
return ""
|
|
}
|
|
|
|
var b strings.Builder
|
|
|
|
for _, c := range s {
|
|
if c == '\uFFFD' {
|
|
continue
|
|
}
|
|
b.WriteRune(c)
|
|
}
|
|
|
|
return b.String()
|
|
}
|