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 16757 - .nbattrs uses \uXXXX and not XML encoding
Summary: .nbattrs uses \uXXXX and not XML encoding
Status: CLOSED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Filesystems (show other bugs)
Version: 3.x
Hardware: PC Linux
: P4 blocker (vote)
Assignee: rmatous
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-19 14:25 UTC by Jesse Glick
Modified: 2008-12-22 19:42 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2001-10-19 14:25:07 UTC
I just noticed that XMLMapAttr when reading/writing .nbattrs files
(and presumably also layers?) uses Java-style \uXXXX Unicode escapes
for non-ASCII characters (or something). Is this really right (and if
so is it documented)? Shouldn't it be using XML character entities,
since it is reading/writing XML? Anyway it sets the file encoding to
UTF-8 so I assume international characters (e.g. in <attr
stringvalue="..."/>) are safe there; for '<' etc. it should use "&lt;"
IMHO, not the \uXXXX escape. As far as control characters go, if these
cannot be represented even with numeric character entities, I would
suggest using serialdata="..." in values, and throwing an IOException
in keys (which ought not be random garbage anyway).
Comment 1 _ pkuzel 2001-10-19 14:41:58 UTC
I think such escaping must be used for control characters and it is
correct if user's "\uXXX" text is properly escaped. For any other
characters it is just extra work. UTF-8 encoded XML document will
handle all other characters transparently.
Comment 2 Jesse Glick 2001-10-19 15:43:55 UTC
What is the exact rule for purposes of documentation? AFAIK this
convention is undocumented. What if \uXXXX and XML escapes are mixed,
etc.? Is the string "\\u1234" in fact converted properly by
XMLMapAttrs if stored by the user? If we use some custom encoding not
defined by XML it must be clearly documented and we must be careful
that it is 100% reversible.
Comment 3 _ ttran 2001-11-22 21:36:16 UTC
it's too late.  NB 3.3 is going out, we'll have to be backward
compatible with the format we use now.
Comment 4 _ pkuzel 2001-11-23 10:45:02 UTC
It can be achieve in back comaptible manner, but in next release.
Comment 5 rmatous 2002-04-18 15:22:33 UTC
Fixed in trunk. There are still used Java-style \uXXXX Unicode escapes
for ISO control characters and
minimal set of character entities (see XMLUtil.toAttributeValue). 

XMLMapAttr.java
new revision: 1.32; previous revision: 1.31
Comment 6 Jan Zajicek 2002-04-22 13:03:19 UTC
verified in the trunk
Comment 7 Quality Engineering 2003-07-01 16:11:09 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.