Re: FW: Re: Invalid UTF-8

William Spitzak <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <[email protected]>
Oren Ben-Kiki wrote:

> As for %DEFAULT...SCALAR directives (suggested by BlueGM): 

I think a huge problem with the proposal is that it makes YAML "modal". 
If you cut a piece of text out and insert it elsewhere in the file, it 
might not mean the same thing (yet still parse) because you put it 
before/after the directive.

I'm thinking that allowing a *set* of tags might work, though I am not 
sure if this will parse. For instance:

  - !!MyClass "ascii representation"
  - !!MyClass !!binary "adf89asdf00asdfasdf..."

This has some appeal because YAML already allows "zero or one" tag in 
the file. So there already is a variable sized array.

> As far as '%20' goes: I strongly believe that '%20' should be a space
> and not '%' '2' '0' inside such !!utf-u. The only argument against it
> was mangling of URLs, and it fails on two accounts.

I agree with this. Your explanation is good:

> First, there's simply no reason to ever use this tag for encoding URLs.
> All the URLs (actually all the URIs) in the world can be easily
> processed as normal YAML strings. They have their own (%nn) built-in
> escape mechanism. { path: "file://foo%ff" } _already_ works, without
> having to annotate it with !!utf-u. So why would you ever want to?
> 
> Second, even if you decided to pass a URL inside a !!utf-u tag (for some
> strange reason), the fact that %20 would be preserved but %80 would be
> mangled to %2580 is _extremely_ confusing. Requiring % to always be
> escaped as %25 is a no-brainer; it is simple, consistent and follows the
> rule of least surprise.

I think I was confused by thinking that *all* strings would be quoted 
this way. It is only necessary if it has some invalid UTF-8 in it. A URL 
would never have it (as it would *already* be expanded to %nn). And I 
suspect a printf format should not have any in it either, as that means 
it is producing invalid UTF-8 on the output.

------------------------------------------------------------------------------
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.