SShortSingh.
Back to feed

Invisible characters can silently break string comparisons in code

0
·5 views

Strings that look identical may compare as unequal because of hidden characters such as no-break spaces, zero-width spaces, and byte order marks. These often come from copying text out of PDFs, web pages, or word processors. The article explains which code points cause the problem and where they typically originate. It offers JavaScript helpers to reveal and remove them, while warning that zero-width joiners are needed for some emoji and scripts. The author recommends normalising input at boundaries like form submission and CSV import, and notes that the article's author runs a free online whitespace-cleaning tool.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Free Browser-Based Concrete Calculators Built With Plain HTML and JavaScript

A developer from Pakistan created Concrete Calculator Now, a free set of US-unit concrete calculators built only from HTML, CSS, and JavaScript without frameworks or a build step. The site works either hosted online or offline by opening index.html directly from a saved folder. Its ten tools estimate poured volume, bag counts, blocks, weight, and cement-sand-gravel ratios, with no backend or third-party scripts. The article explains the approach, including converting slab thickness from inches to feet and applying a one-time waste allowance before calculating bag counts. The author also shares core functions to show how the math is structured and separated from the page interface.

0
ProgrammingDEV Community ·

FileHarbor: Open-Source Tool Turns Existing Hosting Into a File Storage API

A developer has released FileHarbor, an open-source, self-hosted file management server available in PHP and Node.js versions. It is designed to let users turn a VPS or shared hosting plan they already own into a file storage API. Applications can upload supported files such as images, videos, and documents, which remain ordinary files on the server while the application keeps its own metadata. The tool requires no mandatory external database server or Docker setup, offering an alternative to services like S3 and R2. The creator is developing the project openly and invites feedback, issues, and contributions.

0
ProgrammingDEV Community ·

Enterprise AI Needs Context and Decision Traceability, Not Just Vector Search

A DEV Community article argues that many AI agents can retrieve information but cannot explain how facts connect, where they originated, or why a decision was reached. It contends that enterprise AI requires knowledge graphs that link entities, evidence, and causal relationships. The author describes Semantica, a system whose ContextGraph API records decisions, links them causally, traces decision chains, and checks them against policy rules. The piece stresses that such provenance and explainability matter most in regulated sectors like finance and healthcare. It concludes by suggesting organizations audit individual AI decisions to determine whether they have full decision-intelligence infrastructure.

0
ProgrammingDEV Community ·

Practical Cybersecurity Tips Small Businesses Can Use to Protect Their Data

Cybersecurity is increasingly vital for businesses, yet small companies are especially exposed to threats like phishing, ransomware, and data breaches due to limited resources and dedicated IT staff. The article outlines 16 practical measures, such as using strong unique passwords and enabling two-factor authentication. It also recommends keeping software updated, training employees to spot social engineering, and securing Wi-Fi networks. Regular data backups following the 3-2-1 strategy are highlighted as a way to limit disruption from data loss.