libboost-nowide

[brief]

Standard library functions with UTF-8 API on Windows

Branch Appveyor Github codecov.io Deps Docs Tests
master Build status codecov Deps Documentation Enter the Matrix
develop Build status codecov Deps Documentation Enter the Matrix

Quality checks: Coverity Scan Build Status CodeFactor

Library for cross-platform, unicode aware programming.

The library provides an implementation of standard C and C++ library functions, such that their inputs are UTF-8 aware on Windows without requiring to use the Wide API.

License

Distributed under the Boost Software License, Version 1.0.

Properties

Note on the last point: Having a compiled library allows cross-platform access to e.g. setenv which would not be available when using a -std=c++nn flag. This is different to the version available prior to the inclusion in Boost.

Requirements (All versions)

Requirements (Boost version)

Requirements (Standalone version)

The standalone branch keeps track of the develop branch and can be used without any other part of Boost. It is automatically updated so referring to a specific commit is recommended. You can also use the standalone source archive which is part of every release.

Quickstart

Instead of using the standard library functions use the corresponding member of Boost.Nowide with the same name. On Linux those are (mostly) aliases for the std ones, but on Windows they accept UTF-8 as input and use the wide API for the underlying functionality.

Examples:

To also convert your input arguments to UTF-8 on Windows use:

int main(int argc, char **argv)
{
    boost::nowide::args _(argc, argv); // Must use an instance!
    ...
}

See the Documentation for details.

Compile

With Boost

Compile and install the Boost super project the usual way via ./b2. The headers and library will then be available together with all other Boost libraries. From within CMake you can then use find_package(Boost COMPONENTS nowide) and link against Boost::nowide. Note that find_package(boost_nowide) will find the package too, but the above is the canonical way.

With CMake

Boost.Nowide fully supports CMake. So you can use add_subdirectory("path-to-boost-nowide-repo") and link your project against the target Boost::nowide.

You can also pre-compile and install Boost.Nowide via the usual workflow:

mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local
make install

A CMake-Config file will be installed alongside Boost.Nowide so find_package(boost_nowide) does work out-of the box (provided it was installed into a "standard" location or its INSTALL_PREFIX was added to CMAKE_PREFIX_PATH).

Boost.Filesystem integration

Boost.Nowide integrates with Boost.Filesystem:

More information

license BSL-1.0
project boost
url github.com/boostorg/nowide
doc-url www.boost.org/doc/libs/1_83_0/libs/nowide
topics C++Boost
4 Versions
version 1.83.0
repository https://pkg.cppget.org/1/stable
depends 2; libboost-config, libboost-filesystem
version 1.81.0+1
repository https://pkg.cppget.org/1/stable
depends 2; libboost-config, libboost-filesystem
version 1.78.0
repository https://pkg.cppget.org/1/stable
depends 2; libboost-config, libboost-filesystem
version 1.77.0+1
repository https://pkg.cppget.org/1/stable
depends 2; libboost-config, libboost-filesystem