I wrote a quick portlet to test. Kept things simple. The Java code, process action:

public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException
    {
        String tester = actionRequest.getParameter("tester");
        if (tester != null)
        {
            System.out.println("tester = " + tester);
            String [] values = tester.split("\u00a6");
            System.out.println("values = " + values);
        }

then my JSP:

<%
String fieldSeparator= "\u00a6";
%>

<input type="hidden" name ="tester" id="tester" value="a< %=fieldSeparator%>b<%=fieldSeparator%>c"/>

With the debugger, I can see that values is correctly split into 3 values, a, b, c.

I also tested this with Groovy, just to make sure:

groovy> String DELIM = "\u00a6";
groovy> String x = "a" + DELIM + "b" + DELIM + "c";
groovy> String []y = x.split(DELIM);

Result: ["a", "b", "c"]

So maybe we are using different web containers?
Im on Tomcat 5.5.27

On Jan 17, 2009, at 10:22 AM, JetWork wrote:


I am using Jetspeed 2.1.3 version

In Java file I am declaring field separator as:

class TestVal
{
..... <<code>>
public final static String separator= "\u00a6";

.... <<code>>
}

In JSP, I have declared page-encoding in page declarative as "UTF-8"

In scriplets i am assigning this value to a String variable

<%

String fieldSeparator= TestVal.separator;

%>

Then I am using this fieldSeparator in my javascript when user clicks on
process button like

<script type="text/javascript">
function addFieldSeparators()
{
    document.getElementById("txt1").value + <%=fieldSeparator%> +
    document.getElementById("txt2").value + <%=fieldSeparator%> +
    document.getElementById("txt3").value
}
</script>

After submitting the form, i am using the following logic in the above
mentioned Java class i.e. TestVal

class TestVal
{

..... <<code>>
public final static String separator= "\u00a6";

.... <<code>>
 public void processValues(String s)
 {
     String [] values=s.split(TestVal.separator);

 }
}

I am facing problem while splitting the string, it is not splitting on the basis of separator character (broken bar value 166) , when i try to use, separator as "\\|" (this is keyboards pipe symbol i.e ascii 124), then it
works fine and i am able to split the string.

Please suggest.
If you need files, i can upload the actual JSP and Java files.

Thanks and regards


David Sean Taylor-2 wrote:


On Jan 15, 2009, at 2:41 AM, JetWork wrote:


In my Java file, I am declaring a field separator as following:

String fieldSeparator= "\u00a6"; (which is a broken bar)

When I access and print in JSP, it prints the following character '
ยช '

But in log file it shows me the correct character i.e. broken bar.

Actually in jsp, i am using this character as field separator and in
java i
am splitting the string on this particular character, In java i am
able to
split, as it is treated as different character.

Why I am posting this issue in Jetspeed 2, because we have one other
portal,
on that it is working perfectly.



What version of Jetspeed?
Could you paste in the code you are using in Java to make the
fileSeparator variable available to your JSP
Seeing the JSP code could help as well


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: jetspeed-user- [email protected]




--
View this message in context: 
http://www.nabble.com/Jetspeed-2-Unicode-problem-tp21475159p21519189.html
Sent from the Jetspeed - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to