File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ package main
22
33import (
44 "html"
5- "io"
65 "log"
76 "net/url"
87 "os"
@@ -13,7 +12,6 @@ import (
1312 "unicode/utf8"
1413
1514 "golang.org/x/text/cases"
16- "golang.org/x/text/encoding/charmap"
1715 "golang.org/x/text/language"
1816 "golang.org/x/text/unicode/norm"
1917)
@@ -186,16 +184,6 @@ func RemoveHtmlTag(s string) string {
186184 return s
187185}
188186
189- // TibiaDataConvertEncodingtoISO88591 func - convert string from UTF-8 to latin1 (ISO 8859-1)
190- func TibiaDataConvertEncodingtoISO88591 (data string ) (string , error ) {
191- return charmap .ISO8859_1 .NewEncoder ().String (data )
192- }
193-
194- // TibiaDataConvertEncodingtoUTF8 func - convert string from latin1 (ISO 8859-1) to UTF-8
195- func TibiaDataConvertEncodingtoUTF8 (data io.Reader ) io.Reader {
196- return norm .NFKC .Reader (charmap .ISO8859_1 .NewDecoder ().Reader (data ))
197- }
198-
199187// TibiaDataSanitizeEscapedString func - run unescape string on string
200188func TibiaDataSanitizeEscapedString (data string ) string {
201189 return html .UnescapeString (data )
Original file line number Diff line number Diff line change @@ -1289,14 +1289,8 @@ func TibiaDataHTMLDataCollector(TibiaDataRequest TibiaDataRequestStruct) (string
12891289 return string (res .Body ()), nil
12901290 }
12911291
1292- // Convert body to io.Reader
1293- resIo := bytes .NewReader (res .Body ())
1294-
1295- // wrap reader in a converting reader from ISO 8859-1 to UTF-8
1296- resIo2 := TibiaDataConvertEncodingtoUTF8 (resIo )
1297-
12981292 // Load the HTML document
1299- doc , err := goquery .NewDocumentFromReader (resIo2 )
1293+ doc , err := goquery .NewDocumentFromReader (bytes . NewReader ( res . Body ()) )
13001294 if err != nil {
13011295 log .Printf ("[error] TibiaDataHTMLDataCollector (URL: %s) error: %s" , res .Request .URL , err )
13021296 return "" , err
You can’t perform that action at this time.
0 commit comments