Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSP can't display Russian characters

I have a JSP file that contains paragraphs with Russian text. However, no matter what I do I can't get a browser to display that text - instead all I get is hieroglyphs.

The same text but in a simple HTML file without any headers or declarations works fine:

<html>
  <head></head>
  <body>some russian text</body> 'is displayed fine
</html>

But the moment I save that file as JSP and try to view it in a browser the text gets broken.

I tried

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Also I tried

<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">

But neither works. My file is in UTF-8 encoding.

like image 949
parsecer Avatar asked Oct 27 '25 06:10

parsecer


1 Answers

jsp is most likely not using utf-8 ,try

<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
like image 82
Ramanlfc Avatar answered Oct 28 '25 20:10

Ramanlfc



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!