Return-Path: Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: (qmail 22653 invoked from network); 28 Feb 2011 17:47:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 28 Feb 2011 17:47:05 -0000 Received: (qmail 61762 invoked by uid 500); 28 Feb 2011 17:47:04 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 61083 invoked by uid 500); 28 Feb 2011 17:47:03 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 61050 invoked by uid 99); 28 Feb 2011 17:47:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Feb 2011 17:47:02 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Feb 2011 17:47:02 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 4117941AB7 for ; Mon, 28 Feb 2011 17:46:42 +0000 (UTC) Date: Mon, 28 Feb 2011 17:46:42 +0000 (UTC) From: "Uwe Schindler (JIRA)" To: dev@lucene.apache.org Message-ID: <854634901.2222.1298915202263.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1417745295.2184.1298914537005.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] Commented: (LUCENE-2942) toString() methods on term/queries/etc are wrong: assume utf-8 encoded bytes. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LUCENE-2942?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13000427#comment-13000427 ] Uwe Schindler commented on LUCENE-2942: --------------------------------------- Maybe we should add a method to BytesRef that is called: toHumanReadableString(). Internally it could quickly be implemneted as calling utf8ToString() and fallback on Exception. Or is there a faster was to detect if its valid UTF-8? > toString() methods on term/queries/etc are wrong: assume utf-8 encoded bytes. > ----------------------------------------------------------------------------- > > Key: LUCENE-2942 > URL: https://issues.apache.org/jira/browse/LUCENE-2942 > Project: Lucene - Java > Issue Type: Bug > Affects Versions: 4.0 > Reporter: Robert Muir > > In Lucene's trunk, a Term is just a Bytesref. > In a lot of cases this is a UTF-8 encoded string, but in some cases its not (e.g. collation fields). > The problem is that the toString methods all currently call utf8ToString(). > This is wrong, though from a practical point of view i think just printing the bytes won't be very helpful for debugging most cases where the bytes really are utf-8 encoded. > So i think in these cases we should use the following technique: if the bytes are a valid utf-8 sequence, use BytesRef.utf8tostring(), otherwise just print the bytes: BytesRef.toString() > its no problem for performance because toString is only for debugging anyway. -- This message is automatically generated by JIRA. - 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