aboutsummaryrefslogtreecommitdiff
path: root/src/NetUtils.cpp
diff options
context:
space:
mode:
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
};