[sword-svn] r266 - trunk/webapp

scribe at www.crosswire.org scribe at www.crosswire.org
Tue Nov 14 21:39:11 MST 2006


Author: scribe
Date: 2006-11-14 21:39:11 -0700 (Tue, 14 Nov 2006)
New Revision: 266

Modified:
   trunk/webapp/bookdisplay.jsp
   trunk/webapp/wordsearchresults.jsp
Log:
Start of support for UTF-8 keys.  This is really silly.


Modified: trunk/webapp/bookdisplay.jsp
===================================================================
--- trunk/webapp/bookdisplay.jsp	2006-11-14 18:29:22 UTC (rev 265)
+++ trunk/webapp/bookdisplay.jsp	2006-11-15 04:39:11 UTC (rev 266)
@@ -54,10 +54,10 @@
 	// open our current entry in tree
 	if ((module != null) && (forceOpen)) {
 		module.setKeyText(gbsEntry);
-		String tmp = module.getKeyText();
+		String tmp = new String(module.getKeyText().getBytes("iso8859-1"), "UTF-8");
 		while (tmp.length() > 0) {
 			bookTreeOpen.add(tmp);
-			tmp = module.getKeyParent();
+			tmp = new String(module.getKeyParent().getBytes("iso8859-1"), "UTF-8");
 		}
 	}
 
@@ -118,7 +118,7 @@
 		if (module != null) {
 	%>
 			<div id="genbook">
-				<h2><%= gbsEntry %></h2>
+				<h2><%= new String(gbsEntry.getBytes("iso8859-1"), "UTF-8") %></h2>
 				<h3><a href="fulllibrary.jsp?show=<%= URLEncoder.encode(module.getName()) %>"><%= module.getDescription().replaceAll("&", "&amp;") + " (" + module.getName() + ")" %></a></h3>
 	<%
 			module.setKeyText(gbsEntry);
@@ -144,11 +144,12 @@
 							for (int i = 0; i < children.length; i++) {
 								String k = parent + "/" + children[i];
 								module.setKeyText(k);
-								k = module.getKeyText();
+								k = new String(module.getKeyText().getBytes("iso8859-1"), "UTF-8");
+								boolean curVerse = (k.equals(new String(gbsEntry.getBytes("iso8859-1"), "UTF-8")));
 								String[] heads = module.getEntryAttribute("Heading", "Preverse", "0", true);
 								if (heads.length > 0) {
 			%>
-					<tr><td colspan="2"><div <%= rtol ? "dir=\"rtl\"" : "" %> class="<%= (k.equals(gbsEntry)) ? "currentverse" : "verse" %>">
+					<tr><td colspan="2"><div <%= rtol ? "dir=\"rtl\"" : "" %> class="<%= curVerse ? "currentverse" : "verse" %>">
 						<h3><span class="verse"><%= new String(heads[0].getBytes("iso8859-1"), "UTF-8") %></span></h3></div></td></tr>
 			<%
 								}
@@ -158,15 +159,15 @@
 			<%
 								if (!rtol) {
 			%>
-					<td valign="top" align="right"><div <%= rtol ? "dir=\"rtl\"" : "" %> class="<%= (k.equals(gbsEntry)) ? "currentverse" : "verse" %>">
+					<td valign="top" align="right"><div <%= rtol ? "dir=\"rtl\"" : "" %> class="<%= curVerse ? "currentverse" : "verse" %>">
 					<span class="versenum"><a <%= (k.equals(gbsEntry))?"id=\"cv\"":"" %> href="bookdisplay.jsp?gbsEntry=<%= URLEncoder.encode(k)+"#cv" %>">
-						<%= children[i] %></a>
+						<%= new String(children[i].getBytes("iso8859-1"), "UTF-8") %></a>
 					</span></div></td>
 			<%
 								}
 			%>
 
-					<td><div <%= rtol ? "dir=\"rtl\"" : "" %> class="<%= (k.equals(gbsEntry)) ? "currentverse" : "verse" %>">
+					<td><div <%= rtol ? "dir=\"rtl\"" : "" %> class="<%= curVerse ? "currentverse" : "verse" %>">
 
 <%
 								String lang = module.getConfigEntry("Lang");
@@ -182,9 +183,9 @@
 			<%
 								if (rtol) {
 			%>
-					<td valign="top" align="right"><div <%= rtol ? "dir=\"rtl\"" : "" %> class="<%= (k.equals(gbsEntry)) ? "currentverse" : "verse" %>">
+					<td valign="top" align="right"><div <%= rtol ? "dir=\"rtl\"" : "" %> class="<%= curVerse ? "currentverse" : "verse" %>">
 					<span class="versenum"><a <%= (k.equals(gbsEntry))?"id=\"cv\"":"" %> href="bookdisplay.jsp?key=<%= URLEncoder.encode(k)+"#cv" %>">
-						<%= children[i] %></a>
+						<%= new String(children[i].getBytes("iso8859-1"), "UTF-8") %></a>
 					</span></div></td>
 			<%
 								}
@@ -235,7 +236,7 @@
 
 		int offset = rootTreeKey.lastIndexOf("/");
 		String[] children = module.getKeyChildren();
-		boolean open = bookTreeOpen.contains(rootTreeKey);
+		boolean open = bookTreeOpen.contains(new String(rootTreeKey.getBytes("iso8859-1"), "UTF-8"));
 		boolean dig = (children.length > 0);
 		if (dig) {
 			if ("2".equals(module.getConfigEntry("DisplayLevel"))) {
@@ -251,7 +252,7 @@
 		}
 
 		if (rootTreeKey.length()>0) {
-			String localName = rootTreeKey.substring(offset+1);
+			String localName = new String(rootTreeKey.substring(offset+1).getBytes("iso8859-1"), "UTF-8");
 			String linkRef = rootTreeKey;
 			if (target.equals(rootTreeKey))
 				out.print("<li id=\"current\">"); //the current entry in the navigation tree
@@ -259,7 +260,7 @@
 				out.print("<li>");
 
 			if (dig) {
-				out.print("<a " + (rootTreeKey.equals(currentJumpNode)? "id=\"cur\"":"") + " class=\"" + ((open)?"closed":"open") + "\" href=\"bookdisplay.jsp?" + ((open)?"close":"open") + "=" + URLEncoder.encode(rootTreeKey) + "#cur\"><img src=\"images/" + ((open)?"minus":"plus") + ".png\" alt=\"action\"/></a>");
+				out.print("<a " + (rootTreeKey.equals(currentJumpNode)? "id=\"cur\"":"") + " class=\"" + ((open)?"closed":"open") + "\" href=\"bookdisplay.jsp?" + ((open)?"close":"open") + "=" + URLEncoder.encode(new String(rootTreeKey.getBytes("iso8859-1"), "UTF-8")) + "#cur\"><img src=\"images/" + ((open)?"minus":"plus") + ".png\" alt=\"action\"/></a>");
 			}
 			else if (children.length > 0) {
 				linkRef = rootTreeKey + "/" + children[0];

Modified: trunk/webapp/wordsearchresults.jsp
===================================================================
--- trunk/webapp/wordsearchresults.jsp	2006-11-14 18:29:22 UTC (rev 265)
+++ trunk/webapp/wordsearchresults.jsp	2006-11-15 04:39:11 UTC (rev 266)
@@ -132,9 +132,10 @@
 			for (int i = resultStart.intValue(); i < results.length && i < resultStart.intValue() + resultLimit.intValue(); i++)
 			{
 				activeModule.setKeyText(results[i].key);
+				String dispKey = new String(results[i].key.getBytes("iso-8859-1"), "UTF-8");
 		%>
 				<dt>
-					<a href="<%= ("GBS".equals(lastModType))?"bookdisplay.jsp?gbsEntry=":"passagestudy.jsp?key=" %><%= URLEncoder.encode(results[i].key)+"#cv" %>" title="<%= results[i].key %>"><%= results[i].key %></a>
+					<a href="<%= ("GBS".equals(lastModType))?"bookdisplay.jsp?gbsEntry=":"passagestudy.jsp?key=" %><%= URLEncoder.encode(dispKey)+"#cv" %>" title="<%= dispKey %>"><%= dispKey %></a>
 					<span><%= (results[i].score > 0)?("score: " + results[i].score) : "" %></span>
 				</dt>
 				<% boolean rtol = ("RtoL".equalsIgnoreCase(activeModule.getConfigEntry("Direction"))); %>




More information about the sword-cvs mailing list