In my application, it’s sometimes motivated to use variant style of letters.
Maybe often the case is they can work properly (copy-paste workflow to julia REPL).
But occasionally (maybe 10% of the chance), we encounter the error as written in the title.
Here is a case
You see that in the first julia> the code is accepted without error, in which I used \ttg.
But then in the second julia> it cannot identify the same symbol. (the unknown unicode character is essentially \ttg).
I wonder how can I avoid this error?
By the way, there are some nice identifiers that are very stable and hardly errors, e.g. the \o symbol. And the Greek letters. (But they are not enough for me.)
Where are you copying the text from? Some apps reformat the text automatically and mess up the characters (" is a common issue), but I’d expect that to be consistent, not just 10%.
Besides one of those characters not being supported in Symbols, it doesn’t even seem plausible to accidentally mix up the code units. It really just changed that specific character without affecting the surroundings. Apparently it’s a “replacement character used to replace an unknown, unrecognised, or unrepresentable character,” but I can’t imagine why 𝚐 is only sometimes recognized.
To clarify, do you mean executing a selected block of code with Alt+Enter? Or are you manually copying lines from the source code and manually pasting into the VS Code REPL? To be clear, either way shouldn’t change characters like this.
I also suggest changing the title of your post. You’re not trying to parse an unsupported character, a supported character really is changing sometimes when you copy and paste lines within VS Code, which would also be bad if it’s changing to another supported character. I wonder, would you run into the same issue if you paste into a REPL outside of VS Code, open in a separate terminal? I for one have tried copying and pasting the 𝚐 character around and can’t reproduce this issue no matter where the REPL is, also on Windows 11.
It might be worth trying some of the other characters in the U1… blocks to see whether there’s a general issue with the higher Unicode numbers. A problem with just the Teletype g seems unlikely
No, I don’t even know what this action means.
I select a block of code, and click right key, choose “copy” in the menu. And then move to the left powershell region which is occupied by the julia REPL (see my image above), and then click right key (which is the default setting of VScode) to paste them.
I haven’t try it yet. But I’m not prepared to work anywhere else. VScode is a good environment for developing things.
I sent a r.jl file via DMS to you just now. (Is it sent successfully?)
If you use include("src/r.jl"), then it can run some results successfully.
But if you copy-paste it, then you are expected to see ERROR: ParseError:... Note that you don’t have to really run my code since you are not supposed to have the dependent packages (e.g. Gurobi.jl). Here is a trick to reproduce, you just use quote-end to enclose some of my code. I’ve tried it. It can as well reproduce the ERROR: ParseError:...
That’s the thing, it shouldn’t be different from opening PowerShell (currently Windows default terminal) separately and starting a Julia REPL there.
Thanks for the tip, and it makes sense for the ParseError flagging Julia code specifically, not other text in string quotes and such. I tried it again this way, I still can’t run into the error, whether I stay inside VSCode, stay outside VSCode, or go back and forth to a separate Powershell process; I keep getting the proper 𝚐 character (as well as the other highlighted almost-ASCII characters), not the �� replacement characters. I think we might need other Windows users to look at this, this is starting to look like an encoding problem.
It’s a different julia-vscode specific way to execute selected code, has some perks but I don’t expect it to be relevant to this issue.
It’s repeatable. If I copy lines 63 to >=69 of r.jl (not the same file as original post) via either VSCode or a separate text editor, the double replacement characters replace the 2nd 𝙻 every time it’s pasted into a quote in the REPL in a Powershell process via the VSCode terminal, NOT in the REPL in a separate Powershell process or the file itself. The same effect occurs for the 2nd 𝙳 in lines 62 to >=63:
The effect does not occur if I select more preceding lines, though I obviously haven’t exhausted every selection possible. I’m much more confident now that this is specific to pasting in the REPL via VS Code, and it’s more deterministic than what unrepeated copies suggest.
To me this sounds like something going wrong outside of julia - can you check if the character is also replaced when pasted into a different place? Maybe your locale/windows language settings have something to do with it?
I can’t speak for WalterMadelim, but for me, it doesn’t seem like it’s about a particular ASCII-resembling character (VSCode highlights these). Major edits like copying more lines or minor edits like a name or spacing affect whether the pasting issue occurs and which character is replaced. I’m pretty sure it’s particular to pasting in the VSCode terminal, pasting just about everywhere else didn’t cause this (besides what I mentioned earlier, I also tried Microsoft Word).
I’m using English (United States), Windows 11.
I noticed that I didn’t quite write this out, so anyone else on Windows 11 can try copying the below and pasting it into a REPL (v1.11.4, v1.10.9, v1.9.4) via the VSCode Terminal:
The pasting issue does not occur with minor changes like removing the semicolons, adding indentations, spacings, or a preceding quote in the copy. It’s this exact text that must be copied, and it doesn’t seem to matter what you type before the paste. Typing quote or """ just saves us UndefVarErrors if we didn’t bother with the necessary definitions and imports.
Yes I agree with this point. I find that my code r.jl—which contains numerous unicode can be run steadily in standalone windows CMD and windows PowerShell. But it produces ParseError in the terminal within VScode.
This example is precisely apt. In my VScode environment it steadily incurs
Your idea is plausible. But to be honest, I don’t know how to make the settings in my VScode. I browsed some websites and asked ChatGPT, yet I have no idea on how to make the configurations.
I’ve read that Github thread. All of setting 1,setting 2, setting 3 don’t work in my computer. Windows is really disquieting. I would consider opt to another OS for my next laptop . It appears that in Julia community, there is seldom Windows users.