datacamp / datacamp/datacamp-light
Accented characters in SCT's incorrect_msg and success_msg
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.4k
- Forks
- 366
- Avg merge
- 2h 17m
- Merged PRs (30d)
- 2
Description
Hello everyone,
While trying to insert accented characters in the incorrect_msg or success_msg of the <code data-type="sct"> tag, they always appear replaced by [removed] (either typing them directly or using encodeURI() which works well for the <div data-type="hint"> tag).
I found a workaround by slightly modifying the StripTagBody function in dcl-react.js.gz :
I replaced the return i || (i = c.position), "[removed]"; statement by
var html = String.fromCharCode("0x" + s.substring(2)).replace(/[\u00A0-\u9999<>\&]/g, function(z) {
return '&#'+z.charCodeAt(0)+';';
});
if (html.substring(0,2)=="&#") {
return i || (i = c.position), html;
}
else {
return i || (i = c.position), "[removed]";
}
Same can be done in dcl-react-dev.js.gz, only param s is now called tag and we only returned var html or string "[removed]" without i || (i = c.position),
Do you think you could integrate this enhancement in the cdn hosted versions of dcl-react ?
Best regards,
Benjamin
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in dcl-react.js.gz at the StripTagBody function and compare the behavior described for SCT incorrect_msg and success_msg with dcl-react-dev.js.gz, where the parameter is named tag. The work is done when accented characters are preserved instead of becoming [removed] and the fix is integrated into the CDN-hosted versions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100