UTF-8 POLISH SYMBOLS GO
Archiviert 3 years ago
W
wagner1766
Dart
i'm getting strange response to MySQL query. I tested the same query in Go with database/sql module and in PHP mysqli. In PHP polish symbols are working but in Go when i log the response i'm getting something like this:
```
2022/10/12 13:32:24 Drukarka 3D ED V1 PRO
2022/10/12 13:32:24 Drukarka 3D CR-3040 PRO - wkr�tce dost�pne
2022/10/12 13:32:24 Mikrokontroler BBC micro:bit
2022/10/12 13:32:24 Zestaw Startowy micro:bit
2022/10/12 13:32:24 Niesamowity Samoch�d
2022/10/12 13:32:24 EduBot
2022/10/12 13:32:24 EduDron
2022/10/12 13:32:24 Kreatywny Konstruktor
2022/10/12 13:32:24 Innowacyjny In�ynier
2022/10/12 13:32:24 Matatalab Pro - wkr�tce dost�pne
2022/10/12 13:32:24 Matatalab TaleBot - wkr�tce dost�pne
2022/10/12 13:32:24 Matatalab Lite - wkr�tce dost�pne
```
Go code:
```go
var products []models.Product
var product models.Product
rows, _ := db.Query("select title from products")
defer rows.Close()
for rows.Next() {
rows.Scan(&product.Title)
title := utf8string.NewString(product.Title)
log.Println(fmt.Sprint(title))
products = append(products, product)
}
json.NewEncoder(w).Encode(products)
```
Anyone here knows how to solve that problem?
