Menu

#844 SQL command: non-breaking spaces are converted to normal spaces

Git
closed-wont-fix
nobody
9
2025-02-19
2022-07-01
Yoji
No

Spent several hours on the problem where I wanted to update some texts in a table, specifically spaces to non-breaking spaces.
The trouble is, when product names include measurement units, the number and the unit must be written with a non-breaking space to prevent breaking. Example 15 cm has to be written as 15 cm.
So I entered a simple SQL command,
update products set default_name=replace(default_name, ' cm', ' cm')
The second ' cm' is written as "apostrophe", "Alt+0160", "cm" and "apostrophe".

The trouble: the textarea input at "SQL command" (<pre contenteditable="true" class="sqlarea jush-sql jush"...) converts the non-breaking space into normal space when migrating the pre content into the hidden textarea.
The result: no rows affected, since the final command is replacing space+cm into space+cm, instead of non-breaking-space+cm.
I solved the trouble with inspect element and changed the hidden textarea content, then submitted the query. This worked, but this method is too cumbersome.

Discussion

  • Jakub Vrána

    Jakub Vrána - 2025-02-19
    • status: open --> closed-wont-fix
     
  • Jakub Vrána

    Jakub Vrána - 2025-02-19

    Adminer does this on purpose because there are nbsps in the textarea accidentally which is very hard to debug. Try something like CHR(160).

     

Log in to post a comment.

MongoDB Logo MongoDB