Commit Graph

6 Commits

Author SHA1 Message Date
Hennadii Stepanov
3bb30658e6 Merge bitcoin/bitcoin#32380: Modernize use of UTF-8 in Windows code
53e4951a5b Switch to ANSI Windows API in `fsbridge::fopen()` function (Hennadii Stepanov)
dbe770d921 Switch to ANSI Windows API in `Win32ErrorString()` function (Hennadii Stepanov)
06d0be4e22 Remove no longer necessary `WinCmdLineArgs` class (Hennadii Stepanov)
f366408492 cmake: Set process code page to UTF-8 on Windows (Hennadii Stepanov)
dccbb17806 Set minimum supported Windows version to 1903 (May 2019 Update) (Hennadii Stepanov)

Pull request description:

  The main goal is to remove [deprecated](https://github.com/bitcoin/bitcoin/issues/32361) code (removed in C++26).

  This PR employs Microsoft's modern [approach](https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page) to handling UTF-8:
  > Until recently, Windows has emphasized "Unicode" -W variants over -A APIs. However, recent releases have used the ANSI code page and -A APIs as a means to introduce UTF-8 support to apps. If the ANSI code page is configured for UTF-8, then -A APIs typically operate in UTF-8. This model has the benefit of supporting existing code built with -A APIs without any code changes.

  TODO:
  - [x] Handle application manifests properly when building with MSVC.
  - [x] Bump the minimum supported Windows version to 1903 (May 2019 Update).
  - [x] Remove all remaining use cases of the deprecated `std:wstring_convert`.
      - The instance in `subprocess.h` will be addressed in a follow-up PR, as additional tests are likely needed.
      - The usage in `common/system.cpp` is handled in https://github.com/bitcoin/bitcoin/pull/32566.

  Resolves partially https://github.com/bitcoin/bitcoin/issues/32361.

ACKs for top commit:
  laanwj:
    re-ACK 53e4951a5b
  hodlinator:
    re-ACK 53e4951a5b
  davidgumberg:
    untested crACK 53e4951a5b

Tree-SHA512: 0dbe9badca8b979ac2b4814fea6e4a7e53c423a1c96cb76ce894253137d3640a87631a5b22b9645e8f0c2a36a107122eb19ed8e92978c17384ffa8b9ab9993b5
2025-10-28 22:41:07 +00:00
Hennadii Stepanov
f366408492 cmake: Set process code page to UTF-8 on Windows
Additionally, this change adds app manifests to targets that were
previously missing them.
2025-10-06 19:41:35 +01:00
Ryan Ofsky
c864a4c194 Simplify fs::path by dropping filename() and make_preferred() overloads
These overloads were needed to allow passing `fs::path` objects directly to
libstdc++'s `fstream` constructors, but after the previous commit, there is no
longer any remaining code that does pass `fs::path` objects to `fstream`
constructors. Writing new code which does this is also discouraged because the
standard has been updated in https://wg21.link/lwg3430 to disallow it.

Dropping these also means its no longer possible to pass `fs::path` arguments
directly to `fstream::open` in libstdc++, which is somewhat unfortunate but not
a big loss because it is already not possible to pass them to the constructor.
So this commit updates `fstream::open` calls.

Additionally, this change required updates to src/bitcoin.cpp since it was
relying on the overloaded filename() method.
2025-10-06 12:14:02 -04:00
Ryan Ofsky
453b0fa286 bitcoin: Make wrapper not require -m
Choose the right binary by default if an IPC option is specified
2025-09-17 04:57:09 -04:00
Ryan Ofsky
f5cf0b1ccc bitcoin wrapper: improve help output
Try to make extra commands more obvious based on a suggestion from Sjors:
https://github.com/bitcoin/bitcoin/pull/31679#issuecomment-2922787970i

When `bitcoin` is invoked with no arguments, still show short help output, but
now explicitly state that more commands are available and `bitcoin help` will
list them.

Also:

- Get rid of -a/--all option. Just show all commands when `bitcoin help` or
  `bitcoin --help` is used. It maybe a helpful to add an option like this if
  more commands are added in the future, but right now there are not very many.

- Just show name of executable, not full path of executable in help output. This
  can be a little easier to read if the path is long.
2025-07-03 17:03:00 -04:00
Ryan Ofsky
9c8c68891b multiprocess: Add bitcoin wrapper executable
Intended to make bitcoin command line features more discoverable and allow
installing new multiprocess binaries in libexec/ instead of bin/ so they don't
cause confusion.

Idea and implementation of this were discussed in
https://github.com/bitcoin/bitcoin/issues/30983

Co-authored-by: Sjors Provoost <sjors@sprovoost.nl>
2025-05-12 14:49:17 -04:00