Skip to content

Instantly share code, notes, and snippets.

View lebe-dev's full-sized avatar
🌊

Eugene Lebedev lebe-dev

🌊
  • Vilnus, Lithuania
View GitHub Profile
// 1. Create text file with windows-1251 (or any other non-utf8 encoding) - source.txt
// 2. Execute that code
val sourceContent = File("source.txt").readText(Charset.forName("windows-1251"))
File("utf8.txt").writeText(String(sourceContent.toByteArray()))
// 3. Check utf8.txt file and you'll see text file with utf-8 encoding
For example sample text in russian windows-1251: а вот и текст