You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Alex Rocher (JIRA)" <ji...@apache.org> on 2013/01/04 20:10:12 UTC

[jira] [Commented] (SOLR-4265) Encoding problem from test console

    [ https://issues.apache.org/jira/browse/SOLR-4265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13544114#comment-13544114 ] 

Alex Rocher commented on SOLR-4265:
-----------------------------------

For me the patch is simple: 2 sources have been modified.

org.apache.solr.common.params
  public MultiMapSolrParams(Map<String,String[]> map,String charset) {
      this.map =map;
      // If not null, assume that the job is ever done.
      if (charset ==null) {
        // Update values of parameter in regard to charset encoding.
        // By default, if charset encoding is not known we assume
        // that it's UTF-8 encoded from HTTP client (mainly browser).
        // Question : this rule is true in Servlet params, the code may no be here ?
        for (Entry<String, String[]> entry : map.entrySet()) {
          String[] values =entry.getValue();
          if (values !=null) {
            for (int i = 0; i < values.length; i++) {
              try {
                // Charset.XXX is better for performances.
                values[i] =new String(values[i].getBytes("ISO-8859-1"), "UTF-8");
              }
              catch (UnsupportedEncodingException e) {
                // FIXME : what to do in this case ? Should never occurs ?
              }
            }
            // Refresh entry : remark, cannot create a new Map for unknown reason, have to update the current one.
            entry.setValue(values);
          }
        }
      }
  }



and

/**
 *
 */
public class ServletSolrParams extends MultiMapSolrParams {
  public ServletSolrParams(ServletRequest req) {
	  super(req.getParameterMap(), req.getCharacterEncoding());
  }

I think that my patch should only impact HTTP layer.



                
> Encoding problem from test console
> ----------------------------------
>
>                 Key: SOLR-4265
>                 URL: https://issues.apache.org/jira/browse/SOLR-4265
>             Project: Solr
>          Issue Type: Bug
>          Components: web gui
>    Affects Versions: 4.0
>         Environment: Windows but, environment independent
>            Reporter: Alex Rocher
>            Priority: Blocker
>
> When you type an accent (in french language for example) in the console query tester, there's no charset conversion.
> Eg.: même is converted into it's ISO-8859-1 representation.
> The reason : getCharacterEncoding from HTTPRequest is not tested. Il it's null, il will assume to convert an UTF-8 encoding charset.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org