JSFiddle - React, Tailwind, and code Playground
HTML
<div data-name="is\bug?"></div>
<div data-name="isug?"></div>
<div data-name="isug?"></div>
<dl id="results"></dl>
CSS
dt { margin-top: 1em }
dd { margin-left: 0 }
JavaScript
// this matches elements with attribute data-name having value "is\bug?" (i.e., the concatenation of "is", a backslash, and "bug?")
select('[data-name="is\\\\bug?"]');
// this matches elements with attribute data-name having value equal to the concatenation of "is", a vertical tab (ASCII/Unicode character 0xB), and "ug?"
select('[data-name="is\\bug?"]');
// this matches elements with attribute data-name having value equal to the concatenation of "is", a backspace (ASCII/Unicode character 0x8), and "ug?"
select('[data-name="is\bug?"]');
function select( selector ) {
var $el = $( selector ),
data = $el.data("name"),
codepoints = jQuery.map(
data ? data.split("") : [],
function( ch ) {
return ch.charCodeAt(0) + ' "' + ch + '"';
}
);
$("#results").append(
"<dt>selector: <code>" +
selector +
"</code></dt>" +
"<dd>attribute value: \"" +
"<code>" + data + "\"</code> (" +
codepoints.join(" ; ") + ")" +
"</dd>"
);
}