Skip to content

'…' ellipsis character is garbled under MSVC - #20755

Closed
noscript wants to merge 1 commit into
vim:masterfrom
noscript:escape-ellipsis
Closed

'…' ellipsis character is garbled under MSVC#20755
noscript wants to merge 1 commit into
vim:masterfrom
noscript:escape-ellipsis

Conversation

@noscript

@noscript noscript commented Jul 12, 2026

Copy link
Copy Markdown
Contributor
Problem:  Source code is not treated as utf-8 by MSVC, so '…'
          character in string literal is interpreted wrong.
Solution: Replace '…' in source code with octal escape sequence.

Example of breakage https://github.com/noscript/vim/actions/runs/29205020293/attempts/1:

Expected
['foo                 ', 'some long virtual t…', '~                   ']
but got
['foo                 ', 'some long virtua�   ', '~                   ']

where "…" is not interpreted properly and its byte length is also wrong, causing garbage in rendering.

The problem is probably bigger than the fix addresses, but I don't have Windows environment and have no opportunity to experiment.

@h-east

h-east commented Jul 12, 2026

Copy link
Copy Markdown
Member
Problem:  Source code is not treated as utf-8 by MSVC, so '…'
          character in string literal is interpreted wrong.

Hmm? The file displays correctly in VS Code.

I don't think this is the right solution.
Isn't it possible that some other issue is causing this?

@noscript

Copy link
Copy Markdown
Contributor Author

It's not about displaying the source code. I suppose if you run the portion of the test in vim compiled by MSVC, you should also see garbage when virtual text is trimmed with ellipsis.

Maybe MSVC needs some flag to treat source files as utf-8, I am not really sure.

@k-takata

Copy link
Copy Markdown
Member

Does this solve the issue (without changing "…" to "\342\200\246")?

--- a/src/Make_mvc.mak
+++ b/src/Make_mvc.mak
@@ -537,7 +537,7 @@ CFLAGS = -c /W3 /GF /nologo -I. -Iproto -DHAVE_PATHDEF -DWIN32 -DHAVE_STDINT_H \
        $(CSCOPE_DEFS) $(TERM_DEFS) $(SOUND_DEFS) $(NETBEANS_DEFS) \
        $(NBDEBUG_DEFS) $(XPM_DEFS) $(SOD_DEFS) $(SOD_INC) $(CHANNEL_DEFS) \
        $(DEFINES) $(CI_CFLAGS) -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \
-       /source-charset:utf-8
+       /utf-8
 
 RCFLAGS = -DVIM_VERSION_PATCHLEVEL=$(PATCHLEVEL)
 

Currently, source-charset is set to utf-8, but execution-charset is not.
Changing it may solve the issue, but may cause another.

Problem:  Source code is not treated as utf-8 by MSVC, so '…'
          character in string literal is interpreted wrong.
Solution: Set utf-8 for both source and execution charsets.
@noscript

Copy link
Copy Markdown
Contributor Author

Changing it may solve the issue, but may cause another.

Thank you for the fix, at least CI passes.

@noscript noscript changed the title Escape '…' ellipsis character in source code '…' ellipsis character is garbled under MSVC Jul 13, 2026
@chrisbra

Copy link
Copy Markdown
Member

Thanks. Let me include it. Since CI is green I hope it won't cause any issues for Windows users.

@chrisbra chrisbra closed this in 56a5df2 Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants