This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 201869 - XmlFileEncodingQueryImpl.getEncoding returns incorrect values
Summary: XmlFileEncodingQueryImpl.getEncoding returns incorrect values
Status: VERIFIED FIXED
Alias: None
Product: xml
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.1
Hardware: All All
: P1 normal (vote)
Assignee: issues@xml
URL:
Keywords:
Depends on:
Blocks: 164644
  Show dependency tree
 
Reported: 2011-09-09 08:11 UTC by Jaroslav Havlin
Modified: 2011-09-27 07:55 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screenshot (25.24 KB, image/png)
2011-09-09 08:11 UTC, Jaroslav Havlin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Havlin 2011-09-09 08:11:54 UTC
Created attachment 110558 [details]
Screenshot

It seems that XmlFileEncodingQueryImpl.getEncoding returns "UTF-8" for all XML files.

I have a project with encoding "ISO-8859-2" that contains an XML file. Editing that file is fine, but when I invoke "Find in Projects" and review matching lines, national characters are displayed incorrectly.

If I invoke "Replace in Projects...", the file is damaged (cut after the first national character)!

Method getEncoding should return charset "ISO-8859-2" for that file.

I'm not sure about the priority, but some data can be destroyed.
Comment 1 Svata Dedic 2011-09-15 13:20:54 UTC
I caught myself -- the XmlFileEncQueryImpl.getEncoding *is* supposed to return different values, actually. The proper way is not to ask for encoding in advance, but using CharsetEncoder/Decoder, which find/replace in files failed to do.

Now it seems OK, tried on project with UTF-8 encoding, but file was with windows 1250 one (system uses iso-8895-2). Fixed.
Comment 2 Quality Engineering 2011-09-17 14:13:47 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/932457b075da
User: sdedic@netbeans.org
Log: #201869: find/replace did not use Charset decoder properly. Incorrect impl of BufferedCharSequence, did not work with ProxyCharset.
Comment 3 Vladimir Riha 2011-09-27 07:55:19 UTC
Verified - "Replace in Projects" and "Find in Projects" works fine in project with ISO-8859-2 encoding

Product Version: NetBeans IDE Dev (Build 201109260601)
Product Version: NetBeans IDE 7.1 Beta (Build 201109252201)
Java: 1.7.0; Java HotSpot(TM) Client VM 21.0-b17
System: Linux version 2.6.38-11-generic running on i386; UTF-8; en_US (nb)