Thanks for sharing your issue. That does sound unusual, since the .trim() function in JavaScript is only supposed to remove leading and trailing whitespace — it shouldn’t affect characters like á, à , é, etc.
To better understand what’s happening and help you troubleshoot, could you please provide a few more details?
What environment are you running this code in? (Browser? Node.js? React Native? VS Code console?)
What encoding are you using? (Is your file set to UTF-8? If it’s in HTML, are you using <meta charset="UTF-8">?)
Are you copying text from external sources like Word, Excel, or Google Docs? These sometimes include invisible or special whitespace characters.
Can you share the exact code snippet you’re using and the output you’re getting? That would really help.
My guess is it might be due to hidden Unicode whitespace characters (like \u00A0 or \u200B) or improper encoding settings. With a bit more context, I’m happy to help you narrow it down!