-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to show weather data on Windows console #18
Comments
Do you have a powershell? |
powershell seems to give a different output. It looks like it is analyzing the webpage.
|
Replacing curl with curl.exe fixed that issue. But the report returned is still garbled.
|
I have the same trouble as well. Using a monospaced font (Consolas) with UTF-8 (65001 code-page) on ConEmu + Cmder. |
The same problem. Powreshell, conemu or cmd.exe all the same. Used source code pro. |
People on Reddit found solution:
|
We should (at least) document it in README.md. Some good examples are appreciated. |
(Invoke-WebRequest "http://wttr.in" -UserAgent curl -UseBasicParsing).content |
@alexsuslin does it work for you? Could you do a screenshot? |
Funny enough, I am from Minsk - and it shows Vietnam =) -BasicParsing is needed when there is no initial Internet Exporer setup. That can be omitted by disabling in group policy or launch IE and proceed with default setup. Also, there is a nice wrapper: https://gist.github.com/9999years/672f06ca425f90ef1f1c946804d1848e P.S. just "curl" is an alias in powershell command Invoke-WebRequest P.P.S. (curl wttr.in -UserAgent curl).Content |
@alexsuslin thank you for the screenshots! Regarding Vietnam, it's a known bug, for the moment it shows weather for the city of NOT (that located in Vietnam) for the locations that are "NOT found" . |
@majkinetor You have no colors in the output (contrary to @alexsuslin ). Was it your intention? |
Nah. I didnt know it was colored |
My 2 cents: @doskey weather=powershell $w = (curl wttr.in -UserAgent curl).Content; echo `r $w.Substring(0, $w.lastIndexOf($([char]0x2518)) + 1).replace($([char]0x2196), $([char]0x005C)).replace($([char]0x2197), $([char]0x002F)).replace($([char]0x2198), $([char]0x005C)).replace($([char]0x2199), $([char]0x002F)); |
Just to let you guys know, that isn't a bug in wttr.in, but a limitation of the current Win32 version of curl. Basically the Windows 10 console starts without VT processing enabled for backward compatibility. wttr.in works properly when ENABLE_VIRTUAL_TERMINAL_PROCESSING is set, except for diagonal wind directions arrows that use a glyph not available in the standard console fonts (Consolas and Lucida Console). |
Turns out that you can enable the You can also enable it by calling the Unfortunately the diagonal arrows are displayed as � on the default conhost.exe. It's bettter on the new Windows Terminal, but the diagonal arrows are now double width (microsoft/terminal#714), breaking the layout. Here's the comparison IMHO all arrows should take 2 cells instead of 1 so that they look prettier |
The command from @majkinetor gives a monochrome output, while the one from @alexsuslin prints the colors nicely for me. Note that later MS did include the real curl to Windows 10 so you can use curl.exe in powershell Funny that I'm from Vietnam and I've never seen an airport with IATA code NOT. Just checked and it's the Marin County Airport from the USA |
@phuclv90 The problem is a little bit broader than you probably think. The only possible two solutions that I see for the moment:
Probably we should implement both of them. And regarding NOT, it was not PS. The @u01jmg3 's workaround should work fine by the way |
Hey all. This issue is caused by the I submitted a PR to curl in Sept 2018, but we've not yet pulled & rebuilt the inbox Issue #216 in the Terminal repo that I've just re-opened, and I am chasing this down internally, and hope that the next Windows 10 release includes an update Will report back once we have a resolution. |
@bitcrazed Thank you Rich for keeping us updated, what about v2.wttr.in ( |
@apolopena What is this? Some related issues? |
I believe this is the roadmap for Windows 10 implementing the console fix @bitcrazed mentioned Oct 16th 2019. At the time of posting this the status was: Due by April 30, 2020 27% complete |
@apolopena ah, ok, also this: https://twitter.com/richturn_ms/status/1248028376100560896 |
@chubin, Awesome. I had a feeling from reading all the threads that there was a build out there with the fix in it. It also looks like eventually the fixed curl.exe will make it into an upcoming windows release/update. |
@apolopena It is not only curl, but the terminal itself too. If I understand it right, it will be soon publicly available |
@chubin Do you mean terminal as in cmd.exe? |
@apolopena I suppose that you don't need |
@chubin Both of these commands below output the entire html page: |
@apolopena if
cmd.exe is a shell like powershell or bash, not terminal. On Windows the default terminal is conhost.exe. The rendering of the characters depend on the terminal and not the shell |
Without |
@phuclv90 @apolopena Thank you for testing and reporting. wttr.in users reported that the fix by @Jaykul worked. I suppose that it depends on the PowerShell version, and some Could you please check if my assumption is correct, and your powershell (in such case you could just for ANSI output with the |
@chubin PowerShell 6.0 and 7.0 are PowerShell Core and is only available with .NET Core which is not installed by default. I'm on the fast insider channel of Windows 10 and have the latest default version. You can see that its version is the same as Windows build version |
@phuclv90 Yes, you are right, I see it now, but the question still remains why does it work for PowerShell 7.0.0 like it should, but not for PowerShell 5.0. I've checked the logs, and I see that PowerShell 5.0 exposes itself in the user-agent header too,
I think I have found the problem. Could you please test it again? (without overriding user-agent and without the |
I've just tried and
|
@phuclv90 Sorry, it was my fault; please try now |
@chubin It's working now |
@chubin Yes it's working now. What did you change? |
@apolopena user-agents here: must be in lower case |
@chubin, @phuclv90 Great, it's all sorted out now. |
Upon further thought what I suggested above would just end up being a suggestion of use for windows users so probably shouldnt be added. |
@apolopena I think it is a good idea to add a small section for Windows users. There are several interesting topics that could be clarified there. Alone the topic that |
@chubin yeah I would be happy to add what ended up working for me best; All via Powershell (due to the |
@apolopena It would be really great if you could write down all your experiences, and give advises to the wttr.in windows users. I mentioned in the README file (at the beginning) that PowerShell is also supported, and gave a small example of a command, that can be used to access the service, but it is not enough to cover all the details. Feel free to add a new section to the README file (I think that just after the "Internationalization and Localization" and before the Installation is the best place for the moment); just add it and send a pull request to me |
Done. |
Thank you @apolopena (merged). Regarding the diagonal wind direction issue: |
Yeah there might not be anything better than using two characters which is a bit cryptic, in that case we might want to think about using NE, NW, SE, SW but that is not ideal either due to localization. Also accurately detecting when the swap needs to happen might be tricky as we don't want false positives. Maybe just query options for english abbreviations and ASCII equivalents is the way to go. Current swaps are: |
The console is not able to display data returned by
curl wttr.in
. It's all garbled. I know it's a Windows problem but do you have any suggestions on how can I make it work.I even tried an external console emulator, ConEmu. No luck there too.
The text was updated successfully, but these errors were encountered: