Re: New invalid UTF-8 proposal using tags and %nn

"BlueGM" <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <B1B8A40F91794709AD62DD75ED1DA970@HWSBRegula>
> From: Oren Ben-Kiki [mailto:[email protected]] 
> Sent: Saturday, September 05, 2009 1:00 PM
> 
> On Sat, 2009-09-05 at 12:22 -0400, BlueGM wrote:
> 
> > 2) What is the canonical form used for that data? Key to how YAML 
> > works with different data types.
> 
> Good question.The simplest way to define it is as 
> (%[0-9a-z][0-9a-z])*.
> Nobody said the canonical form had to be short or 
> human-readable or anything like that. It just needs to be 
> unique. BTW, this is similar to how the canonical form of 
> !!binary is defined.


Ah, so you're thinking the canonical form should just look at the byte
values of the stream with nonescaped characters translated into utf-8
encoded bytes, rather than try to leave valid Unicode characters
underinflated. As I think about it, that makes a lot of sense. Though if we
do that, why bother with the % sign? We could either use the hex
representation or even encode it as base64. A hex representation would take
more space than base64, but would be more efficient to create. Though, since
canonical forms are only needed during comparisons, it may make sense to
optimize the space (to improve comparisons) rather than the initial creation
of the form, and so base64 seems like the better choice here. In either
case, if we're representing just the byte values, why bother with putting a
% sign in front of each byte? Or is that to make the canonical form one of
the presentation forms? If so, then the expression would probably have to be
like this:

    (%[0-9a-f][0-9a-f])*

Originally, I thought it might make sense to have the canonical form be more
like a string's canonical form, only escaping characters if we really needed
to, but as I thought about it, that doesn't make sense since the two
couldn't compare as equal anyways (due to being different data types).

One possible problem with this canonical form, however, is if there are any
writers that simply write the canonical form to the YAML file. I don't know
if there are or not, but, if there are, then while the output would still be
valid, that would be very ugly for this data type. Then again, that is
beyond the scope of the specification or the type's definition.



> Right. Another item to the YAML spec-related work TODO list :-S


Would it help if one of us created an HTML document in the format and style
you use for other data types? If so, I'd be willing, if William doesn't want
to do it (I think he has dibs on me if he does =p).


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.