You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Jérôme Baumgarten (JIRA)" <di...@incubator.apache.org> on 2005/09/27 00:25:52 UTC

[jira] Created: (DIRSNICKERS-110) [TWIX] encoding : missing accents

[TWIX] encoding : missing accents
---------------------------------

         Key: DIRSNICKERS-110
         URL: http://issues.apache.org/jira/browse/DIRSNICKERS-110
     Project: Directory ASN1
        Type: Bug
  Components: BER Runtime  
    Reporter: Jérôme Baumgarten
 Assigned to: Alex Karasulu 


It seems there are problems when encoding accents (I believe it is same with exotic characters like β).

In TwixTransformer, private LdapResult transformLdapResult(LdapResultImpl snickersLdapResult),

I think that line 729 shoud be
twixLdapResult.setErrorMessage( new LdapString( snickersLdapResult.getErrorMessage().getBytes("UTF-8") ) );
an error message can contain accents (or at least that's what I think, I haven't checked with the RFC, it's getting kinda late here in Paris).

Line 753 should be
twixLdapResult.setMatchedDN( new LdapDN( snickersLdapResult.getMatchedDn().getBytes("UTF-8") ) );

Line 780 should be
LdapURL ldapUrl = new LdapURL( referral.getBytes("UTF-8") );


In TwixTransformer, private void transformSearchResultEntry( LdapMessage twixMessage, Message snickersMessage )

Line 977 should be (a DN can definitely contain accents)
searchResultEntry.setObjectName( new LdapDN( snickersSearchResultResponse.getObjectName().getBytes("UTF-8") ) );

SearchResultEntry, public int computeLength() does take into account the fact that the the string value(s) of the attribute will be encoded as UTF-8 in Value.encode(ByteBuffer buffer, String string). So if the value contains characters coded on 2 bytes, there will be an EncoderException saying that the PDU buffer size is too small. Also, according to a mail exchange I had with Emmanuel, there also is another mistake in the length computation, it should be something like :
byte[] bytes = stringValue.getBytes( "UTF-8" );
localValuesLength += 1 + Length.getNbBytes( bytes.length ) +
bytes.length;

Jerome

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DIRSNICKERS-110) [TWIX] encoding : missing accents

Posted by "Jérôme Baumgarten (JIRA)" <di...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/DIRSNICKERS-110?page=comments#action_12330523 ] 

Jérôme Baumgarten commented on DIRSNICKERS-110:
-----------------------------------------------

The ? in my first line should have been the kind of capital B german people have (I guess Stefan sees what I mean).

> [TWIX] encoding : missing accents
> ---------------------------------
>
>          Key: DIRSNICKERS-110
>          URL: http://issues.apache.org/jira/browse/DIRSNICKERS-110
>      Project: Directory ASN1
>         Type: Bug
>   Components: BER Runtime
>     Reporter: Jérôme Baumgarten
>     Assignee: Alex Karasulu

>
> It seems there are problems when encoding accents (I believe it is same with exotic characters like ?).
> In TwixTransformer, private LdapResult transformLdapResult(LdapResultImpl snickersLdapResult),
> I think that line 729 shoud be
> twixLdapResult.setErrorMessage( new LdapString( snickersLdapResult.getErrorMessage().getBytes("UTF-8") ) );
> an error message can contain accents (or at least that's what I think, I haven't checked with the RFC, it's getting kinda late here in Paris).
> Line 753 should be
> twixLdapResult.setMatchedDN( new LdapDN( snickersLdapResult.getMatchedDn().getBytes("UTF-8") ) );
> Line 780 should be
> LdapURL ldapUrl = new LdapURL( referral.getBytes("UTF-8") );
> In TwixTransformer, private void transformSearchResultEntry( LdapMessage twixMessage, Message snickersMessage )
> Line 977 should be (a DN can definitely contain accents)
> searchResultEntry.setObjectName( new LdapDN( snickersSearchResultResponse.getObjectName().getBytes("UTF-8") ) );
> SearchResultEntry, public int computeLength() does take into account the fact that the the string value(s) of the attribute will be encoded as UTF-8 in Value.encode(ByteBuffer buffer, String string). So if the value contains characters coded on 2 bytes, there will be an EncoderException saying that the PDU buffer size is too small. Also, according to a mail exchange I had with Emmanuel, there also is another mistake in the length computation, it should be something like :
> byte[] bytes = stringValue.getBytes( "UTF-8" );
> localValuesLength += 1 + Length.getNbBytes( bytes.length ) +
> bytes.length;
> Jerome

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Assigned: (DIRSNICKERS-110) [TWIX] encoding : missing accents

Posted by "Emmanuel Lecharny (JIRA)" <di...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/DIRSNICKERS-110?page=all ]

Emmanuel Lecharny reassigned DIRSNICKERS-110:
---------------------------------------------

    Assign To: Emmanuel Lecharny  (was: Alex Karasulu)

> [TWIX] encoding : missing accents
> ---------------------------------
>
>          Key: DIRSNICKERS-110
>          URL: http://issues.apache.org/jira/browse/DIRSNICKERS-110
>      Project: Directory ASN1
>         Type: Bug
>   Components: BER Runtime
>     Reporter: Jérôme Baumgarten
>     Assignee: Emmanuel Lecharny

>
> It seems there are problems when encoding accents (I believe it is same with exotic characters like ?).
> In TwixTransformer, private LdapResult transformLdapResult(LdapResultImpl snickersLdapResult),
> I think that line 729 shoud be
> twixLdapResult.setErrorMessage( new LdapString( snickersLdapResult.getErrorMessage().getBytes("UTF-8") ) );
> an error message can contain accents (or at least that's what I think, I haven't checked with the RFC, it's getting kinda late here in Paris).
> Line 753 should be
> twixLdapResult.setMatchedDN( new LdapDN( snickersLdapResult.getMatchedDn().getBytes("UTF-8") ) );
> Line 780 should be
> LdapURL ldapUrl = new LdapURL( referral.getBytes("UTF-8") );
> In TwixTransformer, private void transformSearchResultEntry( LdapMessage twixMessage, Message snickersMessage )
> Line 977 should be (a DN can definitely contain accents)
> searchResultEntry.setObjectName( new LdapDN( snickersSearchResultResponse.getObjectName().getBytes("UTF-8") ) );
> SearchResultEntry, public int computeLength() does take into account the fact that the the string value(s) of the attribute will be encoded as UTF-8 in Value.encode(ByteBuffer buffer, String string). So if the value contains characters coded on 2 bytes, there will be an EncoderException saying that the PDU buffer size is too small. Also, according to a mail exchange I had with Emmanuel, there also is another mistake in the length computation, it should be something like :
> byte[] bytes = stringValue.getBytes( "UTF-8" );
> localValuesLength += 1 + Length.getNbBytes( bytes.length ) +
> bytes.length;
> Jerome

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (DIRSNICKERS-110) [TWIX] encoding : missing accents

Posted by "Emmanuel Lecharny (JIRA)" <di...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/DIRSNICKERS-110?page=all ]
     
Emmanuel Lecharny resolved DIRSNICKERS-110:
-------------------------------------------

    Resolution: Duplicate

This error is a duplicate of DIRSNICKERS-109 (Jira is slow, actually... no need to click twice on submit ;)

> [TWIX] encoding : missing accents
> ---------------------------------
>
>          Key: DIRSNICKERS-110
>          URL: http://issues.apache.org/jira/browse/DIRSNICKERS-110
>      Project: Directory ASN1
>         Type: Bug
>   Components: BER Runtime
>     Reporter: Jérôme Baumgarten
>     Assignee: Emmanuel Lecharny

>
> It seems there are problems when encoding accents (I believe it is same with exotic characters like ?).
> In TwixTransformer, private LdapResult transformLdapResult(LdapResultImpl snickersLdapResult),
> I think that line 729 shoud be
> twixLdapResult.setErrorMessage( new LdapString( snickersLdapResult.getErrorMessage().getBytes("UTF-8") ) );
> an error message can contain accents (or at least that's what I think, I haven't checked with the RFC, it's getting kinda late here in Paris).
> Line 753 should be
> twixLdapResult.setMatchedDN( new LdapDN( snickersLdapResult.getMatchedDn().getBytes("UTF-8") ) );
> Line 780 should be
> LdapURL ldapUrl = new LdapURL( referral.getBytes("UTF-8") );
> In TwixTransformer, private void transformSearchResultEntry( LdapMessage twixMessage, Message snickersMessage )
> Line 977 should be (a DN can definitely contain accents)
> searchResultEntry.setObjectName( new LdapDN( snickersSearchResultResponse.getObjectName().getBytes("UTF-8") ) );
> SearchResultEntry, public int computeLength() does take into account the fact that the the string value(s) of the attribute will be encoded as UTF-8 in Value.encode(ByteBuffer buffer, String string). So if the value contains characters coded on 2 bytes, there will be an EncoderException saying that the PDU buffer size is too small. Also, according to a mail exchange I had with Emmanuel, there also is another mistake in the length computation, it should be something like :
> byte[] bytes = stringValue.getBytes( "UTF-8" );
> localValuesLength += 1 + Length.getNbBytes( bytes.length ) +
> bytes.length;
> Jerome

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira