aboutsummaryrefslogtreecommitdiff
path: root/src/NetUtils.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-08-16 21:13:24 +0200
committerdec05eba <dec05eba@protonmail.com>2021-08-16 21:13:24 +0200
commit5cc735b22570f1667d62958e59ce4910b529f5af (patch)
tree75128a8926a48a612bc892d266032bd7afd9c2cf /src/NetUtils.cpp
parentde4825e548b990493b372237cbef9a790bf114c4 (diff)
Add MyAnimeList (wip)
Diffstat (limited to 'src/NetUtils.cpp')
-rw-r--r--src/NetUtils.cpp16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/NetUtils.cpp b/src/NetUtils.cpp
index 28256cb..0f957d5 100644
--- a/src/NetUtils.cpp
+++ b/src/NetUtils.cpp
@@ -34,17 +34,6 @@ namespace QuickMedia {
std::string unescaped_str;
};
- static bool to_num(const char *str, size_t size, int &num) {
- num = 0;
- for(size_t i = 0; i < size; ++i) {
- const char num_c = str[i] - '0';
- if(num_c < 0 || num_c > 9)
- return false;
- num = (num * 10) + num_c;
- }
- return true;
- }
-
static void html_unescape_sequence_numbers(std::string &str) {
size_t index = 0;
while(true) {
@@ -69,10 +58,13 @@ namespace QuickMedia {
void html_unescape_sequences(std::string &str) {
html_unescape_sequence_numbers(str);
- const std::array<HtmlUnescapeSequence, 4> unescape_sequences = {
+ // TODO: Use string find and find & and ; instead of string_replace_all
+ const std::array<HtmlUnescapeSequence, 6> unescape_sequences = {
HtmlUnescapeSequence { "&quot;", "\"" },
HtmlUnescapeSequence { "&lt;", "<" },
HtmlUnescapeSequence { "&gt;", ">" },
+ HtmlUnescapeSequence { "&mdash;", "—" },
+ HtmlUnescapeSequence { "&nbsp;", " " },
HtmlUnescapeSequence { "&amp;", "&" } // This should be last, to not accidentally replace a new sequence caused by replacing this
};