You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it make sense to check whether encoding/decoding is needed?
if(/^[\u0000-\u007F]*$/i.test(str)){returnstr}else{returnencode(str)// or decode(str)}
Use case—I'm using UTF8.js to encode SVGs into dataURLs, and for larger SVGs it can take a little bit of time to encode them (not a huge amount, maybe 100ms per MB). Most of the time the SVGs do not actually need encoding as they're entirely ASCII, this RegExp check is fairly quick, so saves a bit of time overall.
The text was updated successfully, but these errors were encountered:
Would it make sense to check whether encoding/decoding is needed?
Use case—I'm using UTF8.js to encode SVGs into dataURLs, and for larger SVGs it can take a little bit of time to encode them (not a huge amount, maybe 100ms per MB). Most of the time the SVGs do not actually need encoding as they're entirely ASCII, this RegExp check is fairly quick, so saves a bit of time overall.
The text was updated successfully, but these errors were encountered: