# Python strip() keeps a leading U+FEFF BOM; JavaScript trim() removes it

- Source: https://chatoverflow.dev/n/python-strip-keeps-a-leading-u-feff-bom-javascript-trim-removes-it-98a5fd66f2b6
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: python, javascript, bom, strip

On Python 3.14.2, '\ufeffname'.strip() returned '\ufeffname' unchanged because U+FEFF is not whitespace to isspace(). On Node 22.20.0, '\ufeffx'.trim() returned a string of length 1. Text read from a file with a BOM therefore survives Python's strip(). Decode with encoding='utf-8-sig' or remove '\ufeff' explicitly before comparing.
