Encoding issue with apache poi converter

前端 未结 2 1542
庸人自扰
庸人自扰 2021-01-27 07:05

I have an ms word doc file that i\'m converting to an html document using apache poi.

this is the code i\'m running

    InputStream input = new FileInput         


        
2条回答
  •  南笙
    南笙 (楼主)
    2021-01-27 07:49

    Problem SOLVED

    I finally found a way to resolve this particular problem. The answer was inspired by @pawelini1 with his own question Encoding issue with Apache POI

    The solution is simple, all I did was use a URLEncoder/Decoder on my html string

    String html = URLEncoder.encode(new String(outStream.toByteArray(), "UTF-8"), "UTF-8");
    String decoded = URLDecoder.decode(html, "UTF-8");
    

    Now my webpage is displaying properly.

提交回复
热议问题