Open lewellyn opened 12 years ago
As an aside, it seems (theoretically) trivial to turn most IRIs into "dotted-notation names".
For example, the contrived example of http://www.somecompany.com/apps/enterprise/randomapp could become com.somecompany.apps.enterprise.randomapp fairly easily by:
1) Drop the scheme, colon, and slashes 2) Drop any leading "www." on the domain (but not other subdomains, since they may well be desired in the package ID generated this way) 3) Reverse the domain name 4) Drop any query or fragment identifiers (? and/or #) 5) Drop any file extension at the end of the IRI (a dot followed by 2-4 characters should be sufficient) 6) Convert any remaining slashes into dots
Note that step 5 must be done before step 6 to prevent e.g. http://www.something.com/apps/randomapp/en from losing the ".en" that it would otherwise have.
This may not be the cleanest approach of supporting interoperable IRIs at packaging time, but it certainly strikes me as one of the more obvious approaches.
I have noted that the current BBWP does indeed handle IRIs, but it does so in a way which makes it impossible to use the same Package ID for the PlayBook.
It now simply (naively) replaces all non-alphanumerics with underscores, so the example above (http://www.somecompany.com/apps/enterprise/randomapp) becomes http___www_somecompany_com_apps_enterprise_randomapp instead of the com.somecompany.apps.enterprise.randomapp I had suggested.
This may also have negative implications in the future if a vendor moves from WebWorks to another SDK for some reason. Perhaps the correct solution is to document this behavior and tell vendors who to contact when it comes time to change Package IDs because of this?
Upon further investigation, BBWP is still naive and passes the IRI-format IDs to blackberry-nativepackager which now appears to simply convert any "unusual" characters to underscores. So, the issue still exists in BBWP albeit currently masked.
The current pull request properly handles IRIs as well as passes jake test. There is also a shiny new test for a contrived IRI which is totally valid, though a bit strange, which gives a sane "standard" reverse-dotted representation.
The W3C Widget specs state that the is an IRI. http://www.w3.org/TR/widgets/#the-id-attribute
Unfortunately, if I use an IRI (as other Widget implementations sanely expect), I am unable to package for WebWorks with the same config.xml.
What should I use as a Widget ID that works both for WebWorks and packagers which follow the W3C more closely here?