Return-Path: Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: (qmail 47120 invoked from network); 28 Feb 2011 18:28:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 28 Feb 2011 18:28:04 -0000 Received: (qmail 33833 invoked by uid 500); 28 Feb 2011 18:28:03 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 32996 invoked by uid 500); 28 Feb 2011 18:28:00 -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 32929 invoked by uid 99); 28 Feb 2011 18:27:59 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Feb 2011 18:27:59 +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 18:27:57 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 1053F41EF1 for ; Mon, 28 Feb 2011 18:27:37 +0000 (UTC) Date: Mon, 28 Feb 2011 18:27:37 +0000 (UTC) From: "Robert Muir (JIRA)" To: dev@lucene.apache.org Message-ID: <1134426678.2379.1298917657063.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1417745295.2184.1298914537005.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] Updated: (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 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/LUCENE-2942?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Robert Muir updated LUCENE-2942: -------------------------------- Attachment: LUCENE-2942.patch here's a patch, i only converted the really safe stuff over: toString()s and assertions and some tools in contrib/misc such as HighFreqTerms. > 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 > Attachments: LUCENE-2942.patch > > > 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