How to convert GBK charset to UTF-8 and insert data in MySQL?


Hello everybody

Could you give simple way to conver text loaded from web with GBK charset to UTF-8 and after insert data in mysql table (UTF-8 charset for table)

There is how I get content with GBK charset:

var content = URL(“”).readText(Charset.forName(“GBK”))

There is how insert:
var connection = DriverManager.getConnection(url, user, password)
var stm = connection.prepareStatement(query)
stm.setString(1, content)

If print data I get -> 女式上装

After inserting I get ???



DriverManager.getConnection(url, user, password)

url have to content of jdbc:mysql://localhost:3306/database?useUnicode=yes&characterEncoding=UTF-8

FYI when I do

I get content in Unicode format already

After I need say DB connection to work with Unicode