closure-library
closure-library copied to clipboard
goog.string.trim remove BOM too.
I see that the code uses:
return str.replace(/^[\s\xa0]+|[\s\xa0]+$/g, '');
shouldn't we remove the BOM too as they are useless in utf-8:
return str.replace(/^[\s\uFEFF\u00A0]+|[\s\uFEFF\u00A0]+$/g, '');
Seems reasonable enough at first glance. I'm having trouble finding useful references describing potential issues stripping BOM. If you want to create a PR, we can test it out internally.