summaryrefslogtreecommitdiff
path: root/Source/Core/Common/StringUtil.cpp
AgeCommit message (Collapse)Author
2020-12-15Add NetBSD supportDavid Carlier
2020-10-23Common: Migrate logging to fmtLioncash
Continues the migration of our code over to the fmt logger.
2020-09-21DolphinQt: Handle non-ASCII characters in Windows cmd argumentsJosJuice
CommandLineParse expects UTF-8 strings. (QApplication, on the other hand, seems to be designed so that you can pass in the char** argv untouched on Windows and get proper Unicode handling.)
2020-07-18Merge pull request #8905 from JosJuice/jni-encodingLC
Android: Use correct encoding when converting strings
2020-07-16NetPlay: Limit nickname lengthTechjar
Ridiculously long nicknames cause UI silliness, so 30 characters seems like a reasonable limit, as it's the same as the forum.
2020-07-08Android: Use correct encoding when converting stringsJosJuice
The functions with "UTF" in the name use "modified UTF-8" rather than the standard UTF-8 which Dolphin uses, at least according to Oracle's documentation, so it is incorrect for us to use them. This change fixes the problem by converting between UTF-8 and UTF-16 manually instead of letting JNI do it for us.
2020-07-08Common: Never convert from UCS-2 in WStringToUTF8JosJuice
Probably not something we would run into in practice since Windows uses a separate implementation, but let's do it for the sake of correctness.
2020-07-08Common: Rename UTF16ToUTF8JosJuice
This function does *not* always convert from UTF-16. It converts from UTF-16 on Windows and UTF-32 on other operating systems. Also renaming UTF8ToUTF16 for consistency, even though it technically doesn't have the same problem since it only was implemented on Windows.
2020-03-16StringUtil: Add PathToFileName functionJosJuice
2020-02-09Fix another implicit false-to-nullptr conversionmagiblot
2020-01-16StringUtil: Add IsPrintableCharacter and use itLéo Lam
Add a function that safely returns whether a character is printable i.e. whether 0x20 <= c <= 0x7e is true. This is done in several places in our codebase and it's easy to run into undefined behaviour if the C version defined in <cctype> is used instead of this one, since its behaviour is undefined if the character is not representable as an unsigned char. This fixes MemoryViewWidget.
2020-01-04StringUtil: Make TryParse of floats handle comma and dot decimal separators.Jordan Woyak
2019-12-29Use std::istringstream or std::ostringstream instead of std::stringstream ↵David Korth
where possible. This removes std::iostream from the inheritance chain, which reduces overhead slightly.
2019-08-15Fix implicit false-to-nullptr conversionsQuellaZhang
2019-07-23StringUtil: Comply with variable naming styleJosJuice
2019-07-23StringUtil: Use std::string_view moreJosJuice
2019-06-21Work around C++20 std::filesystem changes related to u8stringJosJuice
2019-06-14Common: Use fmt where applicableLioncash
Begins the transition to using fmt for string formatting where applicable. Given fmt supports formatting std::string instances out of the box, we can remove now-unnecessary calls to .c_str() and .data(). Note that this change does not touch the actual logging subsystem aside from converting the final StringFromFormat call in the process over to fmt::format. Given our logging system is heavily used throughout the entire codebase, and converting that over will be quite a large change by itself, this will be tackled near the end of the conversion process.
2019-02-13Use empty instead of sizeFilip Gawin
2018-11-22Fix spurious error logs for conversions of empty strings on Windows.Jordan Woyak
2018-06-03StringUtil: Remove ValueToString(std::string)Léo Lam
Doesn't make a lot of sense to have a function that gives the string representation for a string.
2018-06-03Move Config ValueToString to StringUtilLéo Lam
An identical implementation is used by IniFile, so move those functions to StringUtil. A future commit will modify IniFile to use them.
2018-04-12Reformat all the things!spycrab
2018-03-26StringUtil: Fix possible bad freeMiikka Juomoja
2018-01-11Modified StringUtil to change UTF16ToUTF8 to use a wstring_convert and ↵34will
codecvt_utf8<wchar_t> to convert a UTF16 wstring to a UTF8 string.
2018-01-11Modified UTF16BEUTF8 to just convert the UTF-16 C-string into a ↵34will
std::u16string, and pass it into CodeToUTF8 with the 'from' parameter being "UTF-16BE", rather than manually performing the big endian to little endian encoding.
2018-01-11Modified StringUtil to use a u16string instead of a wstring in the non-win32 ↵34will
UTF16BEToUTR8 method.
2017-11-11Simplify StringUtil::UTF16ToUTF8JosJuice
2017-11-11Remove unneeded check in StringUtil::UTF16ToUTF8JosJuice
No code is relying on this unexplained null byte check, since the only code that calls UTF16ToUTF8 on non-Windows systems is UTF16BEToUTF8, which explicitly strips null bytes.
2017-11-03When NAND is damaged, show title names from save filesJosJuice
The earlier code always tried to use TitleDatabase for getting title names, but that didn't work for disc-based games, because there was no way to get the maker ID.
2017-11-03Add WiiSaveBanner classJosJuice
This class is similar to the BannerLoaderWii class that was removed in ee694e32.
2017-09-18StringUtil: support TryParse(u16*)Pierre Bourdon
2017-07-05Replace StringFromInt with std::to_stringLéo Lam
Updated version of #47. Android should support to_string now that we use a modern version of libc++ when building.
2017-06-11StringUtil: Make SplitString return by valueLéo Lam
Simpler usage.
2017-06-06StringUtil: StringPopBackIf addedSepalani
2017-05-01Convert VolumeDirectory names back to SHIFT-JIS (issue #9988)spycrab
2017-04-06StringUtil: Fix a ctype assertionSepalani
2017-03-27Initial support for Haiku.Augustin Cavalier
2017-02-25IniFile: Handle s64/u64 valuesLioncash
2017-02-04Translate Swedish in example strings to EnglishJosJuice
2016-12-18Import/Export signature files as CSVSepalani
2016-11-26IOS HLE: More robust escaping of NAND pathsJosJuice
Prevents path traversal without needing an absolute path function, and also improves accuracy (character sequences like ../ appear to have no special meaning in IOS). This removes the creation and usage of /sys/replace, because the new escapes are too complicated to all be representable in its format and because no other NAND handling software seems to use /sys/replace.
2016-07-17OpenBSD doesn't support per-thread locales.Anthony J. Bentley
2016-07-13StringUtil: Make TryParse parse floats as booleansLéo Lam
This is needed to keep compatibility with old configuration files which didn't store booleans as booleans, but as floats/doubles.
2016-06-24Further fixes to the formatting change. WX sucks.Pierre Bourdon
2016-06-24Reformat all the things. Have fun with merge conflicts.Pierre Bourdon
2016-06-18StringUtil: Add a HexDump function.Pierre Bourdon
Generates a string like the following from a binary blob: 000000: 00 00 04 74 79 70 65 00 09 61 70 70 2d 73 74 61 ...type..app-sta 000010: 72 74 rt
2016-01-21Correct ampersands as wellmathieui
2016-01-21More asterisksmathieui
2016-01-21Common: asterisks go against the type namemathieui
not the variable name