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
0
votes
0 answers

Pyspark code giving wierd whitespace error

When I ran this query, zip code is getting some hidden whitespace which pushes over to data-source column. Tried trim function and trim with carriage return, whitespace is not getting removed. Any suggestions? Note: window partition was used to get…
0
votes
1 answer

Website has some trailing space, or overflow

I am building a portfolio page with a combination of flex and grid. on the left side of the page, there is a small gap of about 8 pixels, and my header is uneven. I have tried doing left: -9px; but it doesn't fix the problem. I have tried making…
0
votes
1 answer

Is it 100% safe to strip trailing whitespace from .c/.h source files?

I'd like to automate removal of all trailing whitespace from .c and .h files, to reduce garbage that causes merge conflicts in git history, etc. Is there any conceivable way this could change the output of the compilation stage? Or is it perfectly…
endolith
  • 25,479
  • 34
  • 128
  • 192
0
votes
0 answers

how to input /n on a program that uses getchar() (and other confusion)

This is a pretty loosely fitting title I'll admit. I'm doing an exercise where we are tasked with creating a program that removes trailing whitespace and deletes blank lines. One of the solutions posted online received praise but, when I run the…
0
votes
0 answers

git for Windows: remove trailing whitespace when committing

I've written a pre-commit hook to remove trailing whitespace with git for Windows 2.27.0.windows.1. It seems like a well researched subject, but unfortunately, I cannot get it to work as it should. This is my .git\hooks\pre-commit…
cxxl
  • 4,939
  • 3
  • 31
  • 52
0
votes
1 answer

Why does TSQL not ignore trailing spaces of identifiers when used with a linked server?

I have a query on a database table like this select * from dbo.MyTable which works fine even though for reason I don't know the table MyTable has been created with trailing spaces in the identifier. That should not let me worry as described here…
casenonsensitive
  • 955
  • 2
  • 9
  • 18
0
votes
1 answer

Trim whitespace (trailing newline) at the end of included Twig template

I’m trying to include a Twig template inside another, but there is undesirable whitespace which is caused by the trailing newline in the included template. My use case is that the include takes place mid-sentence, just before a comma, and I don’t…
sylbru
  • 1,461
  • 1
  • 11
  • 19
0
votes
1 answer

Explain where trailing spaces are and aren't ignored in SQL Server

I believed trailing spaces are ignored in SQL everywhere until I encountered a scenario with PATINDEX where they aren’t ignored. Case 1: SELECT PATINDEX('qwerty', 'qwerty') returns 1. Case 2: SELECT PATINDEX('qwerty', 'qwerty ') returns 1. A…
aditya
  • 15
  • 4
0
votes
3 answers

UNDOCUMENTED FEATURE when SELECT in VARCHAR with trailing whitespace SQL Server

I hope this is an interesting puzzle for an SQL expert out there. When I run the following query, I would expect it to return no results. -- Create a table variable Note: This same behaviour occurs in standard tables. DECLARE @TestResults TABLE (Id…
WonderWorker
  • 8,539
  • 4
  • 63
  • 74
1
2