Skip to content

Commit

Permalink
fix Cyrillic domains in antizapret lists
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunamis4tw committed Mar 2, 2024
1 parent c6ac652 commit 3d680a0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"os"
"regexp"
"strings"

"golang.org/x/text/encoding/charmap"
)

func Downloader(configs *Config) error {
Expand Down Expand Up @@ -145,7 +147,11 @@ func parseCsvDumpAntizapret(input string) ([]string, []string) {
var ipAddresses []string
var domains []string

lines := strings.Split(input, "\n")
// Декодируем входную строку из Windows-1251 в UTF-8
decoder := charmap.Windows1251.NewDecoder()
decodedInput, _ := decoder.String(input)

lines := strings.Split(decodedInput, "\n")
for _, line := range lines {
// Разделяем строку на столбцы по символу ";"
columns := strings.Split(line, ";")
Expand Down

0 comments on commit 3d680a0

Please sign in to comment.