summaryrefslogtreecommitdiff
path: root/src/libcamera/utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcamera/utils.cpp')
-rw-r--r--src/libcamera/utils.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libcamera/utils.cpp b/src/libcamera/utils.cpp
index a5232902..da85c9c2 100644
--- a/src/libcamera/utils.cpp
+++ b/src/libcamera/utils.cpp
@@ -335,6 +335,23 @@ details::StringSplitter split(const std::string &str, const std::string &delim)
}
/**
+ * \brief Remove any non-ASCII characters from a string
+ * \param[in] str The string to strip
+ *
+ * Remove all non-ASCII characters from a string.
+ *
+ * \return A string equal to \a str stripped out of all non-ASCII characters
+ */
+std::string toAscii(const std::string &str)
+{
+ std::string ret;
+ for (const char &c : str)
+ if (!(c & 0x80))
+ ret += c;
+ return ret;
+}
+
+/**
* \brief Check if libcamera is installed or not
*
* Utilise the build_rpath dynamic tag which is stripped out by meson at