Normalize string from webpage

Trying to normalize the string "PartII\xa0I \x96 FINANCIAL\n INFORMATION". In general, all that should be left (once non utf-8 characters are excluded) are letters, numbers and dots. Therefore the expected output is "PartII FINANCIAL INFORMATION". The text comes from this Sec form. Solutions tried, where text is the string: text.encode(‘utf-8′, errors=’ignore’).decode(‘utf-8’) unicodedata.normalize(decoding, text) >Solution :… Read More Normalize string from webpage

How do I encode text to utf-16be "correctly"?

I am trying to reproduce the (ABC) example from this site: https://opensource.adobe.com/dc-acrobat-sdk-docs/acrobatsdk/html2015/index.html#t=Acro12_MasterBook%2Fpdfmark_Basic%2FBookmarks_OUT.htm For example, the Unicode string for (ABC) is <FEFF004100420043>. But when I try to reproduce just the ABC, I get: "ABC".encode(encoding="utf-16be") Out[29]: b’\x00A\x00B\x00C’ I think I am misunderstanding a larger concept, but I am unsure what to look for. I need to produce… Read More How do I encode text to utf-16be "correctly"?

I have this error System.ServiceModel.Security.MessageSecurityException

For what I read and understood, this happens when I’m not sending the authentication. But I tried to send it in two ways: string userN = "username"; string _pasw = "password"; BasicHttpBinding binding = new BasicHttpBinding(); Endpoint wsdl = new Endpoint("MyEndpoint"); SoapClient client = new SoapClient(binding, wsdl); client.ClientCredentials.UserName.UserName = userN; client.ClientCredentials.UserName.Password = _pasw; await client.OpenAsync();… Read More I have this error System.ServiceModel.Security.MessageSecurityException

Convert "weird" strings to normal python strings

Context: I’m trying to convert characters like these: 𝐁𝐔𝐈𝐋𝐃𝐈𝐍𝐆 𝙎𝙥𝙚𝙚𝙙𝙮 𝕋𝕌𝔼𝕊𝔻𝔸𝕐 𝕤𝕡𝕒𝕘𝕙𝕖𝕥𝕥𝕚 To normal python strings (speedy, building, tuesday, etc) and save them into a new dataframe to be exported into a new excel file. For example, the charcter 𝕒 (U+1D552) should be converted to a (U+00AA). I’m reading each string from an excel file… Read More Convert "weird" strings to normal python strings

Getting 404 Bad Request when using [FromBody] annotation in API method

I’m trying to send some basic POST data between an MVC and a .NET Core API. When I post the data, I get this error: The remote server returned an error: (400) Bad Request My Controller: [HttpPost] [Route ("simple")] public int PostSimple([FromBody] string value) { return 0; } My POST code to this Controller: string… Read More Getting 404 Bad Request when using [FromBody] annotation in API method

Web-Scraping using R (I want to extract some table like data from a website)

I’m having some problems scraping data from a website. I do have not a lot of experience with web-scraping. My intended plan is to scrape some data using R from the following website: https://www.myfxbook.com/forex-broker-swaps More precisely, I want to extract the Forex Brokers Swap Comparison for all the available pairs. My idea so far: library(XML)… Read More Web-Scraping using R (I want to extract some table like data from a website)

Why is StreamWriter adding random bytes to a file?

I’m trying to translate a virtual key code with ToAsciiEx() and write it to a debug file. For some reason, the output file contains a load of random trash bytes interspersed with the key codes I want to log. I’m importing ToAsciiEx() like this: [DllImport("user32.dll")] static extern int ToAsciiEx(uint uVirtKey, uint uScanCode, byte[] lpKeyState, [Out]… Read More Why is StreamWriter adding random bytes to a file?