The only two invalid characters for macOS filesystems (UFS, HFS+, and HFSX) are slash ('/') and null ('\0')
macOS supports international unicode characters in filenames, the filename must be normalized to Apple's "nearly" Unicode NFD (NFD with Apple HFS+ variations).
macOS always uses NFD on its hfs+ filesystem (or even when using FAT on a memory stick).
(The above assumes you are using the POSIX API, not the legacy pre-macOS API.)
Windows XP and Linux do not perform any normalization, they just store the filename as given.
The following characters are valid in macOS but should be avoided in filenames if you need compatibility with other operating systems:
: (colon)
\ (back-slash)
¢™$® (Unicode symbols)
. , [ ] { } ( ) ! ; " ' * ? < > | (Punctuation marks)
White space characters such as spaces, tabs, new lines and embedded returns.
Related macOS comands:
Cross-platform filename best practices and conventions - Apple Support
unicode.org -
Normalization Form D (NFD)
macOS Syntax