This content has been marked as final.
Show 2 replies
-
1. Re: Problem adding html content with swedish characters
theute Nov 18, 2004 2:02 PM (in response to fredrik)I am pretty this has been solved in the CVS, i just can't find which file was involved right now.
Messages related to your problem has been posted on this forum (I can't find them though) -
2. Re: Problem adding html content with swedish characters
ncd Mar 3, 2005 5:14 AM (in response to fredrik)Hi!
I didnt check CVS for this bugfix, but the bug is in the org.jboss.nukes.common.util.EntityTable class, in thepublic final String convertEntities(String txt)
method
The problem is, when it replaces extra characters, it checks if there is more characters to replace, and if not, then it finishes to process the string.
I fixed it this way:public final String convertEntities(String txt) { StringBuffer result = null; char[] chars = txt.toCharArray(); int previous = 0; for (int current = 0;current < chars.length;current++) { String replacement = lookup(chars[current]); // Do we have a replacement if (replacement != null) { // We lazy create the result if (result == null) { // Allocate 1/2 more than the current txt size result = new StringBuffer(txt.length() * 3 / 2); } // Append the previous chars if any result.append(chars, previous, current - previous); // Append the replaced entity result.append('&').append(replacement).append(';'); // Update the previous pointer previous = current + 1; } else { // finish string if (current == chars.length-1) { result.append(chars, previous, current - previous + 1); } } } return result != null ? result.toString() : txt; }
Then just compile the source and it works fine. I hope I could help.