<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>24581</bug_id>
          
          <creation_ts>2014-02-07 16:58:53 +0000</creation_ts>
          <short_desc>Fix ByteString type &amp; [EnsureUTF16] flag story</short_desc>
          <delta_ts>2014-11-17 18:37:34 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>WebIDL</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>23317</blocked>
    
    <blocked>23346</blocked>
    
    <blocked>25540</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Anne">annevk</reporter>
          <assigned_to name="Cameron McCormack">cam</assigned_to>
          <cc>allen</cc>
    
    <cc>brendan</cc>
    
    <cc>bzbarsky</cc>
    
    <cc>d</cc>
    
    <cc>mike</cc>
    
    <cc>public-script-coord</cc>
    
    <cc>tobie.langel</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>100022</commentid>
    <comment_count>0</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-02-07 16:58:53 +0000</bug_when>
    <thetext>See http://lists.w3.org/Archives/Public/public-script-coord/2013JulSep/0165.html for why [EnsureUTF16] is wrong and ByteString is okay. We should have a consistent story for these conversions:

* code units &lt;-&gt; bytes
* code units &lt;-&gt; code points</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106172</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-05-16 15:19:17 +0000</bug_when>
    <thetext>Per https://github.com/slightlyoff/ServiceWorker/issues/263#issuecomment-43338876 we should have ScalarValueString rather than the current modifier setup.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106320</commentid>
    <comment_count>2</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-05-19 08:47:51 +0000</bug_when>
    <thetext>http://encoding.spec.whatwg.org/#type-scalarvaluestring</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107781</commentid>
    <comment_count>3</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-06-13 12:11:54 +0000</bug_when>
    <thetext>We should also allow ByteString and ScalarValueString to have default values.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108224</commentid>
    <comment_count>4</comment_count>
    <who name="Brendan Eich">brendan</who>
    <bug_when>2014-06-23 16:50:11 +0000</bug_when>
    <thetext>ScalarValueString is Not Great. It uses a Unicode phrase out of context, so does not connote Unicode -- in particular does not suggest that lone surrogates are replaced by U+FFFD -- and also sounds grandiosely general (&quot;scalar value&quot; in what domain? String theory? :-P).

Concrete beats abstract when something very concrete such as U+FFFD replacement is going on under the hood. Any of UnicodeString or UniString or UCString would be better.

A bikeshedding symposium is in order. I don&apos;t have a particular favorite but can provide beverages if nearby.

The big-picture point is: we can do better than ScalarValueString, and we should. The future is bigger than the past. Let&apos;s get this right soon, before ScalarValueString spreads widely and we can&apos;t change it.

/be</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108259</commentid>
    <comment_count>5</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-06-24 08:17:02 +0000</bug_when>
    <thetext>1. ScalarValueString is not in any way exposed. We can always change it. It is specification language.

2. &quot;scalar value&quot; in the context of strings means a code point that is not a lone surrogate. It therefore very accurately describes the intent.

3. An attractive name such as UnicodeString might lead to adoption in places that do not require it. String/DOMString should be used normally.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108269</commentid>
    <comment_count>6</comment_count>
    <who name="Brendan Eich">brendan</who>
    <bug_when>2014-06-24 12:12:51 +0000</bug_when>
    <thetext>(In reply to Anne from comment #5)
&gt; 1. ScalarValueString is not in any way exposed. We can always change it. It
&gt; is specification language.

I know. It&apos;s still a bug to fix rather than spread all over spec-land.

&gt; 2. &quot;scalar value&quot; in the context of strings

In the context of *Unicode strings*.

&gt; means a code point that is not a
&gt; lone surrogate. It therefore very accurately describes the intent.

Asserting accuracy does not demonstrate it.

Spec authors don&apos;t all grok or use Unicode-relative jargon, nor should they have to. Plus, the name&apos;s too long. Oh, and it smells too :-P.

&gt; 3. An attractive name such as UnicodeString might lead to adoption in places
&gt; that do not require it. String/DOMString should be used normally.

UnicodeString is less attractive, but if you are worried about an attractive nuisance, then your assertion #2 fails. Unicode experts know more than enough to use the right type.

Who is the audience here, what&apos;s the threat model?

/be</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108272</commentid>
    <comment_count>7</comment_count>
    <who name="Domenic Denicola">d</who>
    <bug_when>2014-06-24 13:21:02 +0000</bug_when>
    <thetext>&gt; 3. An attractive name such as UnicodeString might lead to adoption in places that do not require it. String/DOMString should be used normally.

I just want to second this. As an API designer, if presented with the choice between `UnicodeString` and `DOMString`, I&apos;d probably choose UnicodeString. (&quot;Of course I want to support Unicode! I bet whatever a DOMString is, it&apos;s to support some weird legacy DOM APIs.&quot;)

I don&apos;t see why ScalarValueString is bad, really, despite the stated reasons. But if this must change for whatever reason, it needs to sound &quot;weird.&quot; Maybe PostprocessedUnicodeString or ScalarizedUnicodeString or something.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108278</commentid>
    <comment_count>8</comment_count>
    <who name="Allen Wirfs-Brock">allen</who>
    <bug_when>2014-06-24 14:45:51 +0000</bug_when>
    <thetext>(In reply to Domenic Denicola from comment #7)

DOMSVString

In seems to have everything we are looking for: unattractive, short, specific.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108288</commentid>
    <comment_count>9</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-06-24 15:31:59 +0000</bug_when>
    <thetext>&gt; Who is the audience here, what&apos;s the threat model?

The threat model is people who have no clue what they&apos;re doing (most web spec authors at one point or another, and quite rationally so) going &quot;Oooh, Unicode is the shiny, I should use that&quot; and not realizing that in this case &quot;Unicode&quot; actually means &quot;dataloss&quot; in many cases.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108369</commentid>
    <comment_count>10</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-06-26 09:17:52 +0000</bug_when>
    <thetext>(In reply to Allen Wirfs-Brock from comment #8)
&gt; DOMSVString
&gt; 
&gt; In seems to have everything we are looking for: unattractive, short,
&gt; specific.

That works for me. Is there any ETA on when this will land in IDL? If it&apos;s going to take long I could rename this in various places before I go away most of July.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112628</commentid>
    <comment_count>11</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2014-10-03 08:32:51 +0000</bug_when>
    <thetext>(In reply to Anne from comment #10)
&gt; That works for me. Is there any ETA on when this will land in IDL? If it&apos;s
&gt; going to take long I could rename this in various places before I go away
&gt; most of July.

Oops, it&apos;s October already. :-(

I agree that &quot;Unicode&quot; might well be an attractive nuisance, particularly if &quot;String&quot; is also in the name.

I&apos;ve gone with &quot;USVString&quot;.  You can now also use string literals for optional argument and dictionary members of any of the string types.

https://github.com/heycam/webidl/commit/672e73d476d8c4341339cc22592bb5ff01c69823

http://heycam.github.io/webidl/#idl-USVString
http://heycam.github.io/webidl/#es-USVString
http://heycam.github.io/webidl/#string-literal
http://heycam.github.io/webidl/#dfn-overload-resolution-algorithm
http://heycam.github.io/webidl/#es-union

Let me know if this is sufficient.  Thanks!

This means we can remove [EnsureUTF16], yes?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112632</commentid>
    <comment_count>12</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-10-03 08:47:31 +0000</bug_when>
    <thetext>(In reply to Cameron McCormack from comment #11)
&gt; This means we can remove [EnsureUTF16], yes?

Please, will review in detail later.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112633</commentid>
    <comment_count>13</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-10-03 08:50:13 +0000</bug_when>
    <thetext>Actually, just did it quickly, text seems fine too, thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112635</commentid>
    <comment_count>14</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2014-10-03 08:56:26 +0000</bug_when>
    <thetext>Great!  Removed [EnsureUTF16]: https://github.com/heycam/webidl/commit/e2cf800ef401578db8d1445d815dc13bc8899554</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112636</commentid>
    <comment_count>15</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-10-03 08:57:08 +0000</bug_when>
    <thetext>Removed ScalarValueString from Encoding: https://github.com/whatwg/encoding/commit/193297f512d34bb952c4473f95324939dd2cc0d6</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>115025</commentid>
    <comment_count>16</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-11-17 18:37:34 +0000</bug_when>
    <thetext>*** Bug 20159 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>