Ryan Marr
Ryan Marr

Reputation: 113

VS code interprets wrong comma from my keyboard

When I type a comma in VS code I get

but what I really want is

, 

I'm not sure why there's two types of commas, but the first one is giving me run time errrors in python

Upvotes: 0

Views: 358

Answers (1)

Stephen C
Stephen C

Reputation: 718798

"I'm not sure why there's two types of commas"

Well ... it is because Unicode defines them1. The first one is U+FF0C : FULLWIDTH COMMA. The second one is U+002C : COMMA

The latter is the one that should be bound to the "comma" key on your keyboard, but it is possible that something has changed your VSCode key bindings. This page describes how to examine your VSCode key bindings.

But I think the more likely explanation is that you have copy-pasted some source code from (for example) a PDF file that is using U+FF0C instead of U+002C for cosmetic reasons ... or something. It ia also possible that they were placed there by the author of the original document, or by their word-processing software.

You could try using the Gremlins extension to highlight any potentially troublesome characters in your source code.


1 - According to Wikipedia, the purpose is "so that older encodings containing both halfwidth and fullwidth characters can have lossless translation to/from Unicode.".

Upvotes: 1

Related Questions