Escaping commas as delimiters

View: New views
7 Messages — Rating Filter:   Alert me  

Escaping commas as delimiters

by mvarshavsky :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm running into an interesting problem that I'm guessing must have surfaced before...

I've got an element in my XSD which is associated w/ a MultiSelectWidget. That allows users to select multiple strings to serve as a value for that particular element.
Those multiple values are stored underneath as comma separated values.

e.g.

Products
---A
---B
---C

if first two products are selected and the document is saved, in control code underneath it gets saved as 'A,B'
The problem arises when one of the product names has a comma in its description
  


Products
---A
---B,B1
---C
     
now in the control code underneath, it is saved with 'A,B,B1'.
Obviously that blurs the line between having two options 'A' and 'B,B1' and three options 'A', 'B', and 'B1' which creates problems when I try to search for things later.

I tried replacing commas w/ unicode values but that didn't work.

Any suggestions?


_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev

Parent Message unknown Re: Escaping commas as delimiters

by Roman-Uhlig :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Maybe OpenCms is treating ',' in a special way regarding XSD's. Try using a different separator like ';' if possible.
 
Roman
 


Von: opencms-dev-bounces@... [mailto:opencms-dev-bounces@...] Im Auftrag von Michael Varshavsky
Gesendet: Donnerstag, 24. September 2009 20:29
An: The OpenCms mailing list
Betreff: [opencms-dev] Escaping commas as delimiters

I'm running into an interesting problem that I'm guessing must have surfaced before...

I've got an element in my XSD which is associated w/ a MultiSelectWidget. That allows users to select multiple strings to serve as a value for that particular element.
Those multiple values are stored underneath as comma separated values.

e.g.

Products
---A
---B
---C

if first two products are selected and the document is saved, in control code underneath it gets saved as 'A,B'
The problem arises when one of the product names has a comma in its description
  


Products
---A
---B,B1
---C
     
now in the control code underneath, it is saved with 'A,B,B1'.
Obviously that blurs the line between having two options 'A' and 'B,B1' and three options 'A', 'B', and 'B1' which creates problems when I try to search for things later.

I tried replacing commas w/ unicode values but that didn't work.

Any suggestions?


_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev

Re: Escaping commas as delimiters

by Claus Priisholm :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The problem is that the individual values are not escaped. Ideally your
example value should end up something like this in the XML file:
'"A","B,B1"' (or a similar approach to escape special characters). As it
is, you cannot have values with commas without getting into trouble.

Michael Varshavsky wrote:

> I'm running into an interesting problem that I'm guessing must have
> surfaced before...
>
> I've got an element in my XSD which is associated w/ a
> MultiSelectWidget. That allows users to select multiple strings to serve
> as a value for that particular element.
> Those multiple values are stored underneath as comma separated values.
>
> e.g.
>
> Products
> ---A
> ---B
> ---C
>
> if first two products are selected and the document is saved, in control
> code underneath it gets saved as 'A,B'
> The problem arises when one of the product names has a comma in its
> description
>  
>
>
> Products
> ---A
> ---B,B1
> ---C
>      
> now in the control code underneath, it is saved with 'A,B,B1'.
> Obviously that blurs the line between having two options 'A' and 'B,B1'
> and three options 'A', 'B', and 'B1' which creates problems when I try
> to search for things later.
>
> I tried replacing commas w/ unicode values but that didn't work.
>
> Any suggestions?
>
>
> ------------------------------------------------------------------------
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev

--
Claus Priisholm, CodeDroids ApS
Phone: +45 48 22 46 46
cpr (you know what) codedroids.com - http://www.codedroids.com
cpr (you know what) interlet.dk - http://www.interlet.dk
--
Javadocs and other OpenCms stuff:
http://www.codedroids.com/community/opencms

_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev

Re: Escaping commas as delimiters

by mvarshavsky :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Claus Priisholm wrote:
The problem is that the individual values are not escaped. Ideally your
example value should end up something like this in the XML file:
'"A","B,B1"' (or a similar approach to escape special characters). As it
is, you cannot have values with commas without getting into trouble.

Right - I guess I was just hoping it would be on opencms to do the escaping, it's a little presumptuous of it to go w/ CSV... anyway, the realization I came to is that in my case there's no good way around changing existent content (which I was really trying to avoid), because it's already at a point of being non-deterministic.

In case somebody runs into a similar situation, the solution I think I'm settling on is to have only variable-style named values in the schema and then key off of that to grab the real display values from a properties file. That should also help w/ i18n.

Thanks for the responses!

Search Bug (also on opencms.org

by NYLister :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

I found what may be a bug in the search.  I wasn’t able to find it discussed about in the forum or through google.

 

I noticed the bug on our site and on the opencms.org site.  If you search for a phrase in double quotes e.g. "alkacon software"  you get multiple pages of results but when clicking on the second or any other page it says no results.

 

On our site it doesn’t say no results on the second page but gives the following error:

 

javax.servlet.jsp.JspException: javax.servlet.ServletException: VFS target resource "/system/modules/org.opencms.frontend.templateone/pages/search.html" was already included earlier.
Reason: VFS target resource "/system/modules/org.opencms.frontend.templateone/pages/search.html" was already included earlier.

 

If you have any suggestions, or if I missed someplace where this is discussed please let me know.

 

Thank you

 

 



_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev

Re: Search Bug (also on opencms.org

by NYLister :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

I was wondering if anyone had an ideas about this?  Any suggestions would be appreciated.

 

From: opencms-dev-bounces@... [mailto:opencms-dev-bounces@...] On Behalf Of list
Sent: Friday, September 25, 2009 3:31 PM
To: 'The OpenCms mailing list'
Subject: [opencms-dev] Search Bug (also on opencms.org

 

I found what may be a bug in the search.  I wasn’t able to find it discussed about in the forum or through google.

 

I noticed the bug on our site and on the opencms.org site.  If you search for a phrase in double quotes e.g. "alkacon software"  you get multiple pages of results but when clicking on the second or any other page it says no results.

 

On our site it doesn’t say no results on the second page but gives the following error:

 

javax.servlet.jsp.JspException: javax.servlet.ServletException: VFS target resource "/system/modules/org.opencms.frontend.templateone/pages/search.html" was already included earlier.
Reason: VFS target resource "/system/modules/org.opencms.frontend.templateone/pages/search.html" was already included earlier.

 

If you have any suggestions, or if I missed someplace where this is discussed please let me know.

 

Thank you

 

 



_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev

Re: Search Bug (also on opencms.org

by Shi Yusen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If it's ok in firefox and wrong in ie, then it's a simple problem:
Add unescape to the query string when getting it
if (CmsStringUtil.isNotEmpty(query)) query = CmsEncoder.unescape(query,
cms.getRequestContext().getEncoding());

Add escape to the query string when setting it
query=<%= CmsEncoder.escape(query,
cms.getRequestContext().getEncoding()) %>

Good luck,

Shi Yusen/Beijing Langhua Ltd.


在 2009-10-14三的 15:00 -0400,list写道:

> I was wondering if anyone had an ideas about this?  Any suggestions
> would be appreciated.
>
>  
>
> From:opencms-dev-bounces@...
> [mailto:opencms-dev-bounces@...] On Behalf Of list
> Sent: Friday, September 25, 2009 3:31 PM
> To: 'The OpenCms mailing list'
> Subject: [opencms-dev] Search Bug (also on opencms.org
>
>
>  
>
> I found what may be a bug in the search.  I wasn’t able to find it
> discussed about in the forum or through google.
>
>  
>
> I noticed the bug on our site and on the opencms.org site.  If you
> search for a phrase in double quotes e.g. "alkacon software"  you get
> multiple pages of results but when clicking on the second or any other
> page it says no results.
>
>  
>
> On our site it doesn’t say no results on the second page but gives the
> following error:
>
>  
>
> javax.servlet.jsp.JspException: javax.servlet.ServletException: VFS
> target resource
> "/system/modules/org.opencms.frontend.templateone/pages/search.html"
> was already included earlier.
> Reason: VFS target resource
> "/system/modules/org.opencms.frontend.templateone/pages/search.html"
> was already included earlier.
>
>  
>
> If you have any suggestions, or if I missed someplace where this is
> discussed please let me know.
>
>  
>
> Thank you
>
>  
>
>  
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev


_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev