wttr.in: Unable to show weather data on Windows console
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.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 48 (36 by maintainers)
Commits related to this issue
- Added example of a power shell usage (#18) — committed to chubin/wttr.in by chubin 4 years ago
People on Reddit found solution:
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. The current Win32 version of curl.exe (shipping in Win10 1809) doesn’t change the configuration of the console, so it inherits whichever mode was set by another process attached to the same console before it. It seems cmd.exe and PowerShell both unset the VT-processing flag before launching external utilities, probably to accommodate for backward compatibility again, assuming if an utility expects VT processing, it will set the flag itself before outputting VT markup. Launching curl.exe from a shell that leaves the VT-processing flag on does result in the expected colorful result, but that means you’d need an intermediate launcher when using it from cmd.exe or PowerShell. The only proper fix is for curl.exe to enable VT-processing. More details if you want : https://github.com/Microsoft/console/issues/216
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).
Hey all. This issue is caused by the
curl.exebuilt into Windows not enabling VT support by default.I submitted a PR to curl in Sept 2018, but we’ve not yet pulled & rebuilt the inbox
curl.exeto benefit from this and other improvements.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
curl.exethat allows us all to check the weather on Windows too 😃Will report back once we have a resolution.
@apolopena user-agents here:
https://github.com/chubin/wttr.in/commit/7801bd04684dd2739942ef4ad186b59e9dee45f7
must be in lower case
My 2 cents:
@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” .
I have the same trouble as well. Using a monospaced font (Consolas) with UTF-8 (65001 code-page) on ConEmu + Cmder.
(Invoke-WebRequest “http://wttr.in” -UserAgent curl -UseBasicParsing).content
Thank you @apolopena (merged). Regarding the diagonal wind direction issue: It would be possible to integrate the solution as proposed by @u01jmg3 in wttr.in itself, but the question is how we can distinguis then between
↖and↘?'\and\,perhaps?@chubin It’s working now
@apolopena if
curlis an alias ofInvoke-WebRequeston your system then you must usecurl.exeto call the curl binary, or just remove the alias completely.curl.exe http://wttr.in/~Golden+Gate+Bridge?2will work without problem.curl.exeis the real binary from libcurl and is very different from theInvoke-WebRequestcmdletcmd.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
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