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

David Sheets <kosmo.zb@gmail.com> writes:

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

I would suggest to use OpenType ligatures for that. You could reasonably
create a ligature font that renders any occurence of “->” as “→”.

-- 
Nils Dagsson Moskopp // erlehmann
<http://dieweltistgarnichtso.net>

Received on Friday, 13 February 2015 13:08:54 UTC