Re: [whatwg] Unicode -> ASCII copy/paste fallback

On Fri, Feb 13, 2015 at 12:18 PM, James M. Greene
<james.m.greene@gmail.com> wrote:
> In this case, you can use Unicode escape values by preceding them with a
> slash:
>
>   .rarr:after { content: "\2192"; }
>
>
> This is specified in the CSS 2.1 spec:
> http://www.w3.org/TR/CSS2/syndata.html#characters
>
> Personally, I probably would've just started on StackOverflow with this
> question (e.g. [1]) but no harm done.

Hi James!

Sorry, I wasn't clear. The issue is not with putting Unicode values
into CSS. The issue is that I would like unicode values to be copied
and pasted as a specific ASCII fallback value.

That is, I would like the equivalent of "a &rarr; b" to appear on a
page but, upon copying, "a -> b" to show up in the clipboard.

I have a solution that works in Firefox 36 (described in original
mail). Chrome 40 does not behave similarly.

I can see some arguments for Chrome's behavior along security lines. I
certainly can understand the utility of Firefox's behavior because I
am writing a documentation generation tool for a programming language
with right arrows represented as -> but would like to render them as
→.

This seems like a pretty straightforward document feature but I can't
seem to get interoperable behavior (or even find where such behavior
might be specified).

Thanks,

David

>
> [1]:
> http://stackoverflow.com/questions/10393462/placing-unicode-character-in-css-content-value
>
> Sincerely,
>     James Greene
>
>
> On Fri, Feb 13, 2015 at 5:45 AM, David Sheets <kosmo.zb@gmail.com> wrote:
>>
>> Hello,
>>
>> I have a page with
>>
>> a <span class="rarr"><span>-&gt;</span></span> b
>>
>> and style
>>
>> .rarr span { overflow: hidden; height: 0; width: 0; display: inline-block;
>> }
>> .rarr::after { content: "→"; }
>>
>> (That's RIGHTWARDS ARROW x2192.)
>>
>> In Firefox 36, this copies and pastes like "a -> b" which is the
>> desired behavior. In Chrome 40, this copies and pastes like "a  b".
>>
>> Is my desired behavior (to show unicode but copy an ASCII
>> representation) generally possible? Are there specs somewhere about
>> copy/paste behavior? I looked in <https://html.spec.whatwg.org/> but
>> found nothing relevant.
>>
>> Is this the right venue for this question? Should I take it somewhere
>> else?
>>
>> Thanks,
>>
>> David Sheets
>
>

Received on Friday, 13 February 2015 12:25:23 UTC