how to fix the "warped characters" issue in a haskell project? [closed] - haskell

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
i cloned this haskell-based blog project:
git clone https://phabricator.chromabits.com/diffusion/B/blog blog-by-chromabits
i setup a blog successfully: http://cb.smt.biz.st ,but a post written in chinese has "warped characters",the post is http://cb.smt.biz.st/posts/2016/08/13/test-1/ ,
how to fix this "warped characters" issue?

Your website is encoded in UTF-8, and does in fact contain proper chinese text. Your problem is that the website doesn't advertise that it is encoded that way, therefore any browser you'll use will simply take an educated guess (which will often be wrong). For example, Chrome on Windows 10 picks Windows-1252 as the character encoding for me, which is of course wrong. A browser on linux might default to UTF-8 instead, so a user like that might not see anything wrong.
A simple bandaid fix for this would be to simply state the encoding in the html header:
<head>
<meta charset="utf-8">
</head>
that will fix it for that page at least. Going forward you should set up your webserver to send the correct encoding in the HTTP header (it's part of the Content-Type header field, see here for details).
You can also tell your browser to use a particular encoding for a website to diagnose issues like this.

Related

Unable to get the contents of a webpage [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 days ago.
Improve this question
Im writing a script and need the contents of for example this webpage:
https://pcb.inc.hp.com/webapp/#/nl-nl/contents/33128146?type=I&hierarchy=F&status=L&status=O
Im using scrapy and usually all works out but I am currently unable to get the html of this page with Requests or scrapy or any other module. Does someone know what could be going wrong?
The website is using AngularJS to dynamically generate content upon loading. You cannot scrape the contents directly from this website, instead I'd suggest using something like Selenium with Python to scrape data.
Or conversely, depending on what you need, you can check the Network tab in Chrome Dev Tools to see the requests being made, and scrape the data from those URLs.
For instance
Request URL: https://pcb.inc.hp.com/api/catalogs/nl-nl/nodes/0/children?status[]=O&status[]=L&hierParadigm=F
Response: {"baseProdname":"ROOT_NODE","oid":0,"level":0,"status":["O","L"],"cultureCode":"nl-nl","children":[{"baseProdname":"Solutions","oid":8176594,"level":1,"status":["L","O"],"cultureCode":"nl-nl"},{"baseProdname":"Scanners/Copiers/Faxes","oid":15179,"level":1,"status":["L","O"],"cultureCode":"nl-nl"},{"baseProdname":"Software","oid":8133386,"level":1,"status":["L","O"],"cultureCode":"nl-nl"},{"baseProdname":"Ink/Toner/Paper/Printer Supplies","oid":12771,"level":1,"status":["L","O"],"cultureCode":"nl-nl"},{"baseProdname":"Laptops and Hybrids","oid":321957,"level":1,"status":["L","O"],"cultureCode":"nl-nl"},{"baseProdname":"Printers and Multifunction","oid":18972,"level":1,"status":["L","O"],"cultureCode":"nl-nl"},{"baseProdname":"Point of Sale Systems","oid":7491307,"level":1,"status":["L","O"],"cultureCode":"nl-nl"},{"baseProdname":"Desktops & Workstations","oid":12454,"level":1,"status":["L","O"],"cultureCode":"nl-nl"},{"baseProdname":"Monitors","oid":382087,"level":1,"status":["L","O"],"cultureCode":"nl-nl"},{"baseProdname":"Services","oid":8362107,"level":1,"status":["L","O"],"cultureCode":"nl-nl"},{"baseProdname":"Accessories","oid":8386448,"level":1,"status":["L","O"],"cultureCode":"nl-nl"},{"baseProdname":"3D Materials and Consumables","oid":20063457,"level":1,"status":["L","O"],"cultureCode":"nl-nl"},{"baseProdname":"Handhelds and Calculators","oid":215348,"level":1,"status":["L","O"],"cultureCode":"nl-nl"},{"baseProdname":"Industries","oid":20008722,"level":1,"status":["L"],"cultureCode":"nl-nl"},{"baseProdname":"Tablets","oid":5169094,"level":1,"status":["O"],"cultureCode":"nl-nl"},{"baseProdname":"Projectors","oid":3338965,"level":1,"status":["O"],"cultureCode":"nl-nl"},{"baseProdname":"Digital Cameras and Photo Studios","oid":382085,"level":1,"status":["O"],"cultureCode":"nl-nl"}]}

How to get the name of next path when navigating [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I am developing an navigation android app that use Skobbler SDK. Currently, the advice received is totally voice data, but I would like to know the name of next path in the route.
Could anyone tell me how can I get the name of the next path when navigating. For example, when I get the instruction is "turn left in 200 meters", how to know what is name of the next path after turn left.
Thanks.
In the 2.3 version, by default the street name is not included in the audio advices - this is due to the fact that we use mp3 files for the audio and street names can not be handled this way.
In 2.4 you will have the possibility of using TextToSpeech as an alternative audio engine so you'll have the possibility of using street names.
What can you do in 2.3?
Handle the didChangeNextStreetName (iOS) callback - this should provide information you are looking for (on Android it's onUpdateNavigationState and call in the SKNavigationState object the getNextAdviceNextStreetName method)
Modify the config file of the advices engine to include the name of the street in the advices (send an email to support for this information)

How to open webpage in HIDDEN default browser, C++?

Disclaimer:
I am aware there is a duplicate for this question but it has no answers. Craig Peterson, Mason Wheeler and other 13 people were wondering why the person who asked a question may need the answer. They said:
because trying to open a webpage and hide it from the user sounds kinda suspicious, and we're honorable coders here who don't want to help anyone write malware. So please convince us you've got some legitimate reason to want to do this, or you're not likely to get any answers.
I tried to edit the original message in order to provide such reason and hopefully get the answer but the modification had been rejected by dgw and albertjan, saying:
This edit is incorrect or an attempt to reply to or comment on the existing post
So I am providing the reason for the question again, I believe it is pretty valid.
The reason:
This may be needed for running a specific Javascript lib, which cannot run on server. For example, for Google Analytics code, which must be run in the default browser (to avoid cookie confusion). And of course, we do not want to open any pages on user desktop although there is nothing to hide really.
Please advise.

write the domain without extension [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I found that sometimes when I write the name of a site it gets to the right website. for example when I write google I get google.com and when I write facebook I get facebook.com.
But when I write mohamedkadri I don't get mohamedkadri.com.
I thought That the browser uses the that name to get the site when it has been previously visited and cached, but I also visited mohamedkadri.com but mohamedkadri doesn't get mohamedkadri.com
How does this work? and who is the responsible for that, the host or the browser, or even the default search engine in my browser?
Thanks
Some browsers use the 'feeling lucky' google search (or other search engines) to return the first result for a given keyword.
If you search on google for 'facebook' you'll get facebook.com as the first result.
If you search for 'mohamedkadri' you don't get 'mohamedkadri.com' as the first result.
It's up to your browser to decide which site to access. In the case of Firefox, the term for the address bar is the 'Awesome Bar', which uses a combination of search, history, and favorites to get you where you want to go Here's some more information
I just did a little testing in Chrome, and it looks like I'm set to a google search if the tld is left off. I'm not sure of the reaction of IE but I think it functions similarly to Chrome.

What are the advantages and disadvantages of a web site that contains a single page? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I would like to code a little web site that will contain several sections like "Home", "Gallery", "Contact Us", "FAQs", and so on.
I thought to do this in one HTML by putting each section in a div and show only one div per time (using Javascript / jQuery), based on the chosen menu button.
Alternatively, I could create a separate HTML page per section, and link these pages to the menu buttons.
What are the advantages and disadvantages of these two methods ?
The first method means longer loading times since you have to load everything on the site up front, and it's totally broken for people who have disabled Javascript or whose browsers don't support it. The second method means the user only has to load the content they are actually looking at, and it should work even with non-Javascript browsers.
The main disadvantages that comes to mind for the first method are:
Poor SEO: Google will only see your home page as Google bot doesn't execute javascript.
Back/Forward buttons won't work.
Takes longer time to load initially.
As site becomes bigger, it'd need more memory and might slow down the browser and even the machine
The advantage of the method would be speed, when navigating you don't need a round-trip to the server.
It also has a couple of disadvantages the main ones are;
You can only link to the front-page, not directly to for example the about page because it doesn't have a separate url.
The back button in the user's browser won't work anymore.
The Advantages of the Javascript solution are mainly that you dont need to reload the page which is very nice for the user.
On the other hand you have the visitors with javascript disabled who wont be able to load the different pages. Also you cannot navigate over Javascript pages with the browser's back and forth buttons.
The last thing I see is that your code could become messy if you're not very careful and organized.
SEO for one thing - Googlebot will likely only ever index the home page, and your other pages will be effectively invisible to search engines.

Resources