Skip to content
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

Weather on windows #15

Closed
jroachgit opened this issue Nov 23, 2020 · 7 comments
Closed

Weather on windows #15

jroachgit opened this issue Nov 23, 2020 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@jroachgit
Copy link

Under windows 10, using 0.9.15 of obsidian and vr 0.4.2 of templater.
The new suggested powershell command to obtain weather does not work.

But the other powershell commands do work.

As a work around, the Linux curl command works anyway ;)
works == curl "wttr.in/Sydney?format=%l:+%C+%t+%p+%w+%h"
doesn't work == powershell ((Invoke-WebRequest -Uri wttr.in/Campsie?format=3).Content)

image

NB: the format setting doesn't seem to impact the outcome.

@jroachgit jroachgit added the bug Something isn't working label Nov 23, 2020
@unstppbl
Copy link

On Windows 10 you should use -UseBasicParsing option for Invoke-WebRequest cmd, so the command will look like this:

powershell ((Invoke-WebRequest -UseBasicParsing -Uri wttr.in/Astana?format=3).Content)

But another problem is that weather emojis and symbols are not recognized properly in Obsidian:

image

@SilentVoid13
Copy link
Owner

Hello @yeders, sorry for the last answer.
I updated the README to include the -UseBasicParsing option as suggested by @unstppbl.
So in your case, this would give powershell ((Invoke-WebRequest -UseBasicParsing -Uri wttr.in/Campsie?format=3).Content)
Could tell me if this command works for you ?
The emojis are another problem that comes from powershell.

@jessycormier
Copy link

@SilentVoid13 I can confirm it doesn't work on windows 10. This isn't just in Obsidian either, it's within PowerShell. However, copying the broken text from PowerShell into Obsidian will make it display correctly. Perhaps this has something to do with how the website is encoding the text?

@jessycormier
Copy link

jessycormier commented Nov 30, 2020

chubin/wttr.in#18 (comment)

Using windows newer terminal supports the emoji's and other features

I do find it odd that Templater when copying the output and once inside of Obsidian it doesn't display correctly but doing it manually does.

@jroachgit
Copy link
Author

My curl command in Win10 is working.
image

Working:
curl "wttr.in/Campsie?format=%l:+%C+%t+%p+%w+%h"

Not working:
powershell ((Invoke-WebRequest -UseBasicParsing -Uri wttr.in/Campsie?format=3).Content)

@luckman212
Copy link

Got a solution for this:

Follow these steps:

Make UTF8 the global default

  1. run intl.cpl
  2. click Change system locale
    image
  3. enable Use Unicode UTF-8
    image
  4. reboot

Templater Template weather

powershell -command "& { (Invoke-WebRequest -Uri 'wttr.in/NewYork?format=3').Content }"

Trigger with <% tp.user.weather() %>

Result

image

@SilentVoid13
Copy link
Owner

As @luckman212 said, unicode chars problems are not coming from Templater, but from cmd.exe and powershell.
I added some documentation on solutions to fix this problem: https://silentvoid13.github.io/Templater/docs/faq#unicode-characters-emojis--are-not-working-on-windows-
Closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants