Questions tagged [trailing-whitespace]

Use this tag for questions related to trailing whitespace characters.

Trailing whitespace characters can be presented/rendered in a way that is not distinguishable from the actual end of the data. This can lead to issues if the data presented to the user differs meaningfully from the actual data.

  • trailing whitespaces in folder names
  • trailing whitespaces in string inputs
  • handling of trailing whitespace: preservation vs. omission
  • preservation of the correct whitespace as different whitespace characters may be displayed in the same way

While SPACE and TAB may be the most common whitespace characters, the Unicode Character Database (source) lists 25 different characters classified as "White_Space":

0009..000D    ; White_Space # Cc   [5] <control-0009>..<control-000D>
0020          ; White_Space # Zs       SPACE
0085          ; White_Space # Cc       <control-0085>
00A0          ; White_Space # Zs       NO-BREAK SPACE
1680          ; White_Space # Zs       OGHAM SPACE MARK
2000..200A    ; White_Space # Zs  [11] EN QUAD..HAIR SPACE
2028          ; White_Space # Zl       LINE SEPARATOR
2029          ; White_Space # Zp       PARAGRAPH SEPARATOR
202F          ; White_Space # Zs       NARROW NO-BREAK SPACE
205F          ; White_Space # Zs       MEDIUM MATHEMATICAL SPACE
3000          ; White_Space # Zs       IDEOGRAPHIC SPACE
24 questions
3
votes
1 answer

in postgresql, how to preserve spaces in char

how to preserve spaces in char? I create 2 tables , create table test_1 (a int, b char(10)) ; create table test_2 (a int, b varchar(255)); and insert one row into test_1 insert into test_1 values (1 ,' '); insert into test_2 select * from…
Cadrick
  • 31
  • 1
2
votes
1 answer

Why are trailing spaces being added during inserting values into a table variable? Why is using the TRIM() function on just one row trimming all rows?

I am working on writing a UDF that searches a string of text for different combinations of white space delimiters (i.e. Carriage Returns, Line Feeds, Spaces, etc.) and replaces them with a different non-white space delimiter. I inserted all the…
Dontjoshme
  • 25
  • 4
2
votes
0 answers

Firefox wrongly trims trailing white space when editing

OS: Linux Mint 18.3, Firefox 72. I've explored this phenomenon and I find it exists only in FF, not in Chrome (for example). This problem applies, in general, to elements (perhaps DIV or TD) when their global attribute contentEditable has been set…
mike rodent
  • 14,126
  • 11
  • 103
  • 157
1
vote
3 answers

Remove white spaces from a KQL string: Kusto

I have a string let String = " Test "; I need an output as below: Output = Test I have tried using trim(), trimstart(), trimend() Only one space has been removed using these scalar functions.
1
vote
0 answers

CSS `overflow-wrap: break-word;` applied to sequence of whitespaces

I struggle to understand what's the expected behavior of overflow-wrap: break-word; when applied to a long sequence of whitespaces, and specifically Ideographic Space (U+3000). So far I've actually tested on all kind of whitespaces (Unicode Category…
hackape
  • 18,643
  • 2
  • 29
  • 57
1
vote
2 answers

Removing trailing whitespace for a tic tac toe board in python

I am trying to resolve the error as highlighted in the picture below. I am able to print a tic-tac-toe board but the trailing whitespace affects the test case. I am not better yet at using strings to represent a list of numbers. The desired output…
1
vote
2 answers

Clear trailing spaces after pasted number in Angular

How do we strip out spaces at the end of the 10digit number when user copies it from place (like email or word docs etc) and pastes it in the search bar? But this function is only working when we hit enter. I want blank spaces to be removed as soon…
aria08
  • 21
  • 3
1
vote
0 answers

React Native Text Trailing Space

I have a simple Text element that loads data from json file,and every thing works fine, but when i apply styling "justify",i found a big trailing space at the end of the Text and cannot remove it. i tried trimming {mydata.trim()}, It did not work,or…
1
vote
1 answer

Can't work out how to remove the trailing whitespace from my result

My code finds the input for a balanced binary tree from an array. array = [178, 57, 26, 157, 679, 397, 898] def myFunc(x): for i in range(1, len(x)): inp = x[i] j=i-1 while j>=0 and inp
Kay
  • 27
  • 5
1
vote
0 answers

Trailing Whitespace and PSR-12 Formatting in Mixed PHP/HTML Files

I'm trying to be more strict about my adherence to PSR-12 and I'm not sure how to handle a specific situation involving whitespace. In the past, I have often used trailing whitespace after a PHP tag to ensure that there is space in the resulting…
Libertie
  • 141
  • 1
  • 10
1
vote
1 answer

Mysql LIKE script ignores trailing space pattern

I have a value 8122 which has a trailing space at the end. Why does my sql script isn't catching this? This is the sql script: select * from values where value like '% ' or value like ' %'; How to set the LIKE to be more sensitive in this sense?
Vladimir Despotovic
  • 3,200
  • 2
  • 30
  • 58
1
vote
1 answer

How to use Set-Location on a folder with trailing spaces in PowerShell?

I have mounted a linux shared folder. In the folder, there is a sub-folder . \ (dot space) which I need to access. With the command prompt I can access it using the 8dot3 notation of short names, but I need to access it with PowerShell. Set-Location…
d82k
  • 379
  • 7
  • 17
1
vote
1 answer

Preserving whitespace with Pygments

I'm currently writing an application that uses Pygments to perform syntax highlighting. The problem I'm having is any code I process with Pygments has the leading and trailing whitespace in the file removed, and a single line break added to the…
0
votes
0 answers

How can I stop seeing trailing whitespace at the end of lines in git?

We have several developers where each controls trailing whitespace differently. On an occasion I see commits that have trailing whitespace. Other than having each person removing their trailing whitespace manually, is there a way to have an…
Dennis
  • 7,907
  • 11
  • 65
  • 115
0
votes
1 answer

using rsync include exclude patterns matches whitespace

i've encountering problems when I use rsync (v3.2.3 on a Pi with Raspbian) with directories containing a whitespace at the end. example: pi:~ $ find source/ source/ source/hello source/hello/whitespace_dir <--- dir with whitespace at the…
1
2