0

I have C++ files saved with Windows1251 encoding. When I hover over a doxygen-documented function, in the preview window there are question marks only. I can't seem to find a setting for that. Any suggestions?

On-hover window

Reproduction

  1. First of all, doc comments have to be in cyrillic.
  2. Doc comments have to be in a separate file (let's call it header.h). Not the active one where I'm hovering.
  3. There should not be an open tab with header.h in VSCode. If you have one, the hover-on preview seems to work.

Example

header.h:

/// @brief  Сумма 2 чисел
/// @param a Число 1
/// @param b Число 2
/// @return Сумма чисел 1 и 2
int sum_int(const int a, const int b)
{
    return a + b;
}

test.cpp:

#include "header.h"

void main()
{
    sum_int(1, 2);
}

Hovering over sum_int in test.cpp provides the following window:

int sum_int(int a, int b)
����� 2 �����

Parameters:
a – ����� 1
b – ����� 2

Returns:
����� ����� 1 � 2
Egor Chubarov
  • 208
  • 1
  • 13
  • Is there a reason you can't change the encoding to UTF-8/Unicode? – sweenish Jun 22 '23 at 13:52
  • I cannot reproduce this with just "hello" in the doc comment. Please provide a [mre]. – starball Jun 22 '23 at 23:37
  • @sweenish Not an option, unfortunately. – Egor Chubarov Jun 23 '23 at 09:25
  • @starball I have updated the original post – Egor Chubarov Jun 23 '23 at 09:38
  • Can you tell us why you can't switch to utf8? All modern compilers support it. – HolyBlackCat Jun 23 '23 at 09:44
  • 1
    @HolyBlackCat I can't switch to UTF-8 because of company-specific requirements. Not my fault. I know UTF-8 would be easier to use. The question isn't really about should I or should I not switch to UTF-8. – Egor Chubarov Jun 23 '23 at 12:34
  • I cannot reproduce your issue with the code that you have now provided. I am on Ubuntu 22.04.2 installed as a Snap. I set the file encoding to Windows 1251, pasted the code of yours, and it renders as one would expect it to. Do you have any doxygen extensions installed? If so, does the issue reproduce when those extensions are disabled? – starball Jun 23 '23 at 20:25
  • huh. I noticed that when I close and reopen, VS Code detects the encoding as utf8 and then that "reproduces" your issue, but once I reopen the file with Windows 1251 encoding, then it's fine again. Is that what's happening to you? – starball Jun 24 '23 at 02:58
  • @starball Maybe. It does actually auto detect encoding as UTF-8 on open. – Egor Chubarov Jun 26 '23 at 06:04
  • ... would you mind doing enough checking to turn that "maybe" into a "yes" or "no"? – starball Jun 26 '23 at 06:09
  • @starball Confirmed it to be a "yes" – Egor Chubarov Jun 26 '23 at 11:43

0 Answers0