Вот как называется страница JSP.
eventMap.jsp?venue=%C4%B0ndigo
Это строка в eventMap.jsp, в которой я получаю параметр места:
var venue="<%= URLDecoder.decode(request.getParameter("venue"),"UTF-8") %>";
К сожалению, это результат в конечном JavaScript:
var venue="Ä°ndigo";
Как правильно использовать кодирование на странице jsp для правильного получения декодированного значения (İngido).
Edit:
Целое событиеMap.jsp
<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import = "java.net.URLDecoder"%>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Event on Map></title>
<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" charset="UTF-8">
function initialize() {
<% request.setCharacterEncoding("UTF-8"); %>
var lat=<%= request.getParameter("lat") %>;
var lng=<%= request.getParameter("lng") %>;
var venue="<%= URLDecoder.decode(request.getParameter("venue"),"UTF-8") %>";
var myLatlng = new google.maps.LatLng(lat,lng);
var myOptions = {
zoom: 15,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title:"Hello"
});
var infowindow = new google.maps.InfoWindow({ content: venue, size: new google.maps.Size(50,50)});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas"></div>
</body>
</html>
Firebug Результат:
<!DOCTYPE html>
2
3
4<html>
5<head>
6<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
7<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
8<title>Event on Map</title>
9<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
10<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
11<script type="text/javascript" charset="UTF-8">
12 function initialize() {
13 var lat=41.062786;
14 var lng=28.981934;
15 var venue="Ä°Tà Kültür Sanat BirliÄi (KSB) Binası Küçük Salon (Maslak)";
16
17 var myLatlng = new google.maps.LatLng(lat,lng);
18 var myOptions = {
19 zoom: 15,
20 center: myLatlng,
21 mapTypeId: google.maps.MapTypeId.ROADMAP
22 }
23 var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
24
25 var marker = new google.maps.Marker({
26 position: myLatlng,
27 map: map,
28 title:"Hello"
29 });
30
31 var infowindow = new google.maps.InfoWindow({ content: venue, size: new google.maps.Size(50,50)});
32 google.maps.event.addListener(marker, 'click', function() {
33 infowindow.open(map,marker);
34 });
35
36 }
37</script>
38</head>
39<body onload="initialize()">
40 <div id="map_canvas"></div>
41</body>
42
43</html>