Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What are "CSS character escape sequences"? #352

Closed
edent opened this issue Aug 9, 2017 · 21 comments
Closed

What are "CSS character escape sequences"? #352

edent opened this issue Aug 9, 2017 · 21 comments
Labels
i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response.

Comments

@edent
Copy link
Member

edent commented Aug 9, 2017

Re Example 6 https://www.w3.org/TR/2017/WD-webvtt1-20170808/#introduction-other-features

Would it be possible to link the text "CSS character escape sequences" to an explanation?

It took me a while to realise that \31 related to the Unicode code point of 1.

https://github.com/w3c/webvtt/blob/gh-pages/index.bs#L394

@silviapfeiffer
Copy link
Member

I think that's a good idea.
BTW: that example was specifically included because WebVTT has visual similarity to SRT and in SRT all the cues are numbered, so if you wanted to reference such cues by CSS, you needed to use the Unicode code point (see https://mathiasbynens.be/notes/css-escapes).

Maybe this is the best place to link to for the explanation: https://www.w3.org/International/questions/qa-escapes

@edent
Copy link
Member Author

edent commented Aug 9, 2017

I think that's an excellent idea.

A small explanation in the text would also be useful.

For example, does 123 become \3123 or \31 23 or \31\32\33?

@silviapfeiffer
Copy link
Member

silviapfeiffer commented Aug 9, 2017

Quoting from https://mathiasbynens.be/notes/css-escapes : "Basically, to escape any numeric character, just prefix it with \3 and append a space character"

so it would be \3123 ?

@edent
Copy link
Member Author

edent commented Aug 9, 2017

This is where I get confused. According to https://googlechrome.github.io/samples/css-escape/ - it should be \31 23

So, a few examples in the spec would be helpful.

@silviapfeiffer
Copy link
Member

yeah, I'm confused also :-)

@aphillips
Copy link

There should be no confusion. If you want to encode "123" it's one of:

\31 \32 \33

Or

\31\32\33 // because \ cannot be a hex digit

Or

\000031\000032\000033

But definitely not:

\3123 // that's ㄣ, a zhuyin/bopomofo character
\31 23 // that's 123, but the 2 and 3 are not escaped: they are just literals

The advice that you can follow \3 with a numeric character only works for the ASCII digits, please note. \3٢ (that's an Arabic script '2') produces garbage.

It's a good idea to have an example like 123 as the label so that you can show one of the valid sequences. It also suggests that the qa-escapes article could use a sequence example.

@silviapfeiffer
Copy link
Member

Thanks for clarifying! Easy to add an example - and yes, the qa-escapes article could do with one also. :-)

@r12a r12a added the i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. label Aug 10, 2017
@dwsinger
Copy link

shouldn't we link to the CSS clause and let/ask them do the appropriate examples?

@edent
Copy link
Member Author

edent commented Aug 10, 2017

I think having a few examples in the document would be helpful. If this is going to confuse people used to SRT files, then the more in-line examples the better.

@zcorpan
Copy link
Member

zcorpan commented Aug 14, 2017

There should be no confusion.

Evidently there is confusion... ^_^

But definitely not:
...
\31 23 // that's 123, but the 2 and 3 are not escaped: they are just literals

\31 23 is actually OK, the whole thing is an ident.

@silviapfeiffer
Copy link
Member

Yeah, I confused myself in the end, so agree with @edent to just add another example.

@edent
Copy link
Member Author

edent commented Aug 15, 2017

Or, is it possible to not use CSS Escaping? Seems like such an obscure requirement.

@silviapfeiffer
Copy link
Member

Nope, your stylesheet will not work to style cues without the escaping.

@r12a
Copy link

r12a commented Aug 16, 2017

Easy to add an example - and yes, the qa-escapes article could do with one also. :-)

Ok, i did it in the lower part of the section at http://w3c.github.io/i18n-drafts/questions/qa-escapes.en#cssescapes

Please could you take a look, and if you're happy with it, i'll publish to the /International site. Thanks.

@aphillips
Copy link

@r12a I think the example is "okay" but confusing because there is something missing from the article, example-wise. I would suggest adding an example of a multi-character escape, e.g. ‘日本語‘ -> \65E5 \672C \8A9E

Otherwise the number (123 -> \31 23) example is confusing.

@r12a
Copy link

r12a commented Aug 16, 2017

@aphillips why would you need to do multiple escaping here? Or are you talking about a different use case?

@aphillips
Copy link

@r12a You don't need it here. I'm suggesting you need it in the article. In the article you only ever show one character being escaped in a row, with the édition/émotion examples. The above thread represents confusion about how additional characters work. If you only show one-in-a-row, it's less clear how the escapes work.

@zcorpan
Copy link
Member

zcorpan commented Aug 17, 2017

@r12a does the article say that non-ASCII has to be escaped in CSS? It does not. .émotion {...} is allowed.

@zcorpan
Copy link
Member

zcorpan commented Aug 17, 2017

PR: #356

@r12a
Copy link

r12a commented Aug 17, 2017

Ok, new text at http://w3c.github.io/i18n-drafts/questions/qa-escapes.en.html#cssescapes including the feedback above. Please review. Thanks.

(I also made additional edits to other parts of the article, including a new quick answer section.)

@zcorpan
Copy link
Member

zcorpan commented Aug 17, 2017

@r12a LGTM.

zcorpan added a commit that referenced this issue Aug 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response.
Projects
None yet
Development

No branches or pull requests

6 participants