Add `keep_whitespace` and `whitespace_chars` to `read_fwf`
- [x] closes #51569
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [x] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [x] Added an entry in the latest `doc/source/whatsnew/v2.0.0.rst` file if fixing a bug or adding a new feature.

This PR adds 2 options to `read_fwf`: `keep_whitespace` and `whitespace_chars`.

In this version, `keep_whitespace` (`bool | tuple(bool,bool) = False`) has a default of `False` to match current behaviour as closely as possible and to reduce the changes required in the integration test file.

However, it still is a default that modifies data while it's being read in. At least the expected behaviour is now clearly documented.

Personally, I'd prefer a default of `(True,False)`, which preserves leading space and strips trailing space - which seems a reasonable compromise.

The tuple represents (leading,trailing) whitespace.  This is an enhancement, giving more fine-grained control over whitespace.

The `whitespace_chars` gives the user the ability to define any character(s) as whitespace to be stripped from fields. Hello @phofl,

I am curious what your opinion is of this technique to resolve the issues (you had chimed in on a previous PR which documented the existing situation, preferring a fix instead)?

Thanks! This pull request is stale because it has been open for thirty days with no activity. Please [update](https://pandas.pydata.org/pandas-docs/stable/development/contributing.html#updating-your-pull-request) and respond to this comment if you're still interested in working on this. Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen. > Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen.

Hi @mroeschke,

I've merged in with main...  Should I open a new PR or can we re-open this one?

Thank you... Thanks I reopened this pull request. ```
 Finished codemodding 167 files!
 - Transformed 167 files successfully.
 - Skipped 0 files.
 - Failed to codemod 0 files.
 - 0 warnings were generated.

Error: Process completed with exit code 1.
```

I don't understand the issue here - no warnings, 0 files failed, yet exit code indicates an error?

About 450 lines into the report on the failed test:

```
pyright reportGeneralTypeIssues............................................Failed
- hook id: pyright_reportGeneralTypeIssues
- duration: 24.53s
- exit code: 1

Loading configuration file at /home/runner/work/pandas/pandas/pyright_reportGeneralTypeIssues.json
Assuming Python version 3.10
Assuming Python platform Linux
Searching for source files
Found 239 source files
pyright 1.1.292
/home/runner/work/pandas/pandas/pandas/_libs/__init__.py
  /home/runner/work/pandas/pandas/pandas/_libs/__init__.py:18:6 - warning: Import "pandas._libs.interval" could not be resolved from source (reportMissingModuleSource)

```

Is this a "me" thing, or an issue with the CI/CD tests?



Thank you for any pointers that I can use to resolve this. Thanks for the pull request, but it appears to have gone stale. Additionally from the original discussion in https://github.com/pandas-dev/pandas/pull/49832, this probably needs more discussion on the original issue (from a core dev familiar with `read_fwf`) so closing for now. 