java – Android encoding -> MS Excel (Windows)


I upload [Russian-language] data to Excel (.xls format) from an Android tablet. Part of the data is written in the code, part is taken from SQLite. When you open the resulting file: in Linux (Libreoffice) – everything is fine with encoding; in Windows 7 (MS Excel) – solid krakozyabry of the form Заказ в„–

Online decoders with UTF8 hints -> CP-1251 and subsequent conversions in type code

new String(text.getBytes("windows-1251"),"utf-8") 

and did not help (it only turned out worse than the пїЅпїЅпїЅпїЅпїЅпї ).

(There have also been attempts to translate in this way from one available encoding to another and vice versa, but in Windows any of them are still displayed as krakozyabrami). Where am I doing something wrong?


(copied from my comment on the question)
Apparently your version of Excel cannot recognize the UTF-8 encoded file (which is weird).
To upload data to a file in CP1251, use: new OutputStreamWriter(new FileOutputStream(fileName), Charset.forName("CP1251"))

Scroll to Top