Bug 181302

Summary: Web Inspector: Zero-width joiners and other hidden Unicode characters are not displayed
Product: WebKit Reporter: Craig Hockenberry <craig.hockenberry>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: bburg, ebrahim, emacemac7, gsnedders, inspector-bugzilla-changes, joepeck, rmondello, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: All   
OS: All   

Description Craig Hockenberry 2018-01-04 12:46:46 PST
Zero-width joiners and other hidden Unicode characters in #text nodes are not displayed in the Web Inspector.

To reproduce:

1) Open this web page:

https://meta.stackoverflow.com/questions/361390/can-posts-to-stack-overflow-be-fingerprinted-using-hidden-unicode-characters

2) Select the "foo" in the "foo * bar" sample code

3) Inspect the element

4) Look at the nodeValue for the #text node

Expected result:

All the Unicode code points in the element should be visible. Chrome displays the HTML entities for the Unicode code points contained within the element:

&zwnj;&#x200B;&zwnj;&#x200B;&zwnj;&zwnj;&zwnj;&#x2060;&zwnj;&zwnj;&#x200B;&zwnj;&#x200B;&#x200B;&#x200B;&#x2060;&zwnj;&zwnj;&#x200B;&#x200B;&#x200B;&#x200B;&zwnj;&#x2060;&zwnj;&zwnj;&zwnj;&#x200B;&zwnj;&#x200B;&#x200B;&#x2060;&zwnj;&#x200B;&#x200B;&#x200B;&#x200B;&#x200B;&#x2060;&zwnj;&zwnj;&#x200B;&#x200B;&zwnj;&#x200B;&#x200B;&#x2060;&zwnj;&zwnj;&#x200B;&zwnj;&zwnj;&zwnj;&zwnj;&#x2060;&zwnj;&zwnj;&#x200B;&#x200B;&zwnj;&#x200B;&zwnj;&#x2060;&zwnj;&zwnj;&zwnj;&#x200B;&#x200B;&zwnj;&zwnj;&#x2060;&zwnj;&#x200B;&#x200B;&#x200B;&#x200B;&#x200B;&#x2060;&zwnj;&zwnj;&#x200B;&#x200B;&zwnj;&zwnj;&#x200B;&#x2060;&zwnj;&zwnj;&#x200B;&zwnj;&zwnj;&zwnj;&zwnj;&#x2060;&zwnj;&zwnj;&#x200B;&zwnj;&zwnj;&zwnj;&zwnj;&#x2060;&zwnj;&#x200B;&#x200B;&#x200B;&#x200B;&#x200B;&#x2060;&zwnj;&zwnj;&#x200B;&#x200B;&zwnj;&#x200B;&zwnj;&#x2060;&zwnj;&zwnj;&zwnj;&#x200B;&zwnj;&zwnj;&#x200B;&#x2060;&zwnj;&zwnj;&#x200B;&#x200B;&zwnj;&#x200B;&zwnj;&#x2060;&zwnj;&zwnj;&#x200B;&zwnj;&zwnj;&zwnj;&#x200B;&#x2060;&zwnj;&#x200B;&#x200B;&#x200B;&#x200B;&#x200B;&#x2060;&zwnj;&zwnj;&#x200B;&zwnj;&zwnj;&#x200B;&zwnj;&#x2060;&zwnj;&zwnj;&#x200B;&#x200B;&zwnj;&#x200B;&zwnj;&#x2060;&zwnj;&zwnj;&#x200B;&#x200B;&#x200B;&#x200B;&zwnj;&#x2060;&zwnj;&zwnj;&#x200B;&zwnj;&zwnj;&zwnj;&#x200B;&#x2060;&zwnj;&zwnj;&zwnj;&zwnj;&zwnj;&zwnj;foo 

Actual result:

Text value is displayed as " foo ".
Comment 1 Radar WebKit Bug Importer 2018-01-04 15:25:48 PST
<rdar://problem/36307533>
Comment 2 Smoley 2021-01-21 19:37:52 PST
*** Bug 220831 has been marked as a duplicate of this bug. ***
Comment 3 Sam Sneddon [:gsnedders] 2021-01-22 11:04:32 PST
What do we want to display escaped? General category C*? Some of White_Space=yes, as well, probably?
Comment 4 Ebrahim Byagowi 2021-01-23 07:52:35 PST
> What do we want to display escaped? General category C*? Some of White_Space=yes, as well, probably?

Oh, finding a unicode category of them also would be nice, it should contain what WebKit initially started at Bug 93888 and ended up to be https://source.chromium.org/chromium/chromium/src/+/master:third_party/devtools-frontend/src/front_end/elements/ElementsTreeOutline.js;l=1679?q=MappedCharToEntity&ss=chromium I started a draft based on the two on https://pastebin.com/1hVMRLD3