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

support for unicode #24

Open
asukaminato0721 opened this issue Feb 8, 2020 · 7 comments
Open

support for unicode #24

asukaminato0721 opened this issue Feb 8, 2020 · 7 comments
Labels
dependency Bug due to dependency issues enhancement New feature or request

Comments

@asukaminato0721
Copy link

asukaminato0721 commented Feb 8, 2020

image

as the image shows, it will warning. But it did can run in .wls.

\[Alpha]=1
Print[\[Alpha]]

besides, I have tested that this can't run.

α=1;Print[α]

in .nb , α will be translated into \[Alpha] ,then do the following calculation.(But shown as α).

So here are some advice.

  1. in vs code, show \[Alpha] as α,but run it as itself.(But it's confusing that how to deal with the widith of this character)
  2. if users copy it to clipboard, automatically change it into α.But if use //CopyToClipboard//UsingFrontEnd,it's also hard to deal with.(Or maybe just ignore it?)
  3. if someone paste α into vscode, change it into \[Alpha] (but shown as α)

Maybe there can be a switch to open/close the "translate"? If some users really want to see \[Alpha].

@kenkangxgwe kenkangxgwe added dependency Bug due to dependency issues enhancement New feature or request labels Feb 9, 2020
@kenkangxgwe
Copy link
Owner

The warning here is not charming to me either. It comes from the Lint paclet. Maybe I can contact Brenton to see if he'd like to change the rule here.


besides, I have tested that this can't run.

image

Did you mean that it CAN run?


Thank you for the advice. Here are my two cents,

  1. Showing special character is a feature which better to be supported by the editor. Our language server should not assume that an editor supports Unicode display. There is a Pretty Symbols Mode extension for VSCode.

  2. Copying as Unicode Character is somehow tricky for LSP because the copy feature is not natively supported, thus the language server knows neither when you copy nor what you copy. What's more, copying into \[Alpha] is the default behavior of MMA (no matter what form you copy as). I do not mean it is good, but I would like to keep it as is for the time being.

  3. I may add a WillSaveTextDocumentParams handler to convert those Unicode characters that users input every time before the file is saved.

Thanks again for your feedback.

@asukaminato0721
Copy link
Author

what I mean is this:
image

@kenkangxgwe
Copy link
Owner

That should be the problem of wolframscript. I can run it with

wolfram -script temp.wl

@asukaminato0721
Copy link
Author

Now I know what's the problem. XD
If I change utf-8 to gbk (Just ignore the warning, because I find the solution here, but I have done it before , and don't want to repeat it.)
image

Main reason is that, MS's cmd is gbk. Cpp will meet the same thing , too.

So there are some solutions:

  1. Convert encoding from utf-8 to gbk. But it will affect the existing Chinese.
  2. Change the system code to UTF-8. But some old softwares will meet trouble.
  3. Using English.

It is worth mentioning that, Python can handle this easily .

@Gravifer
Copy link

Gravifer commented Feb 11, 2021

Main reason is that, MS's cmd is gbk. Cpp will meet the same thing , too.

@wuyudi I was wondering about this, and raised a question at SE-MMA. CMD in Win10 has default utf-8 encoding at least from 1903. I really wonder why Wolfram systems pickup the GBK codepage.

@Gravifer
Copy link

Gravifer commented Feb 19, 2021

I think for the original feature request by @wuyudi, it may be convenient to construct a font with ligatures.
I am just speaking off the top of my head, but we may just PR Wolfram-lang related features to Fira Code, e.g. [[⟶⟦ and so on.
Of course, for arrows and so on this may be sufficient, while for Greek letters the widths are still an issue.

@kenkangxgwe
Copy link
Owner

I think for the original feature request by @wuyudi, it may be convenient to construct a font with ligatures.

See https://github.com/be5invis/Iosevka and the related issue be5invis/Iosevka#680

I am just speaking off the top of my head, but we may just PR Wolfram-lang related features to Fira Code, e.g. [[⟶⟦ and so on.

]] is not possible to be ligatured. E.g. f[g[x]].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependency Bug due to dependency issues enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants