GVM-9 Why Convert ISO_8859-1 into UTF-8 and How to support UTF-8 in NVTs

I install GVM-9 with openvas-scannner is v5.1.3,and src/utils.c has the following code:
auth_send (int soc, char *data)
{
unsigned int sent = 0;
gsize length;

if (soc < 0)
return;

/* Convert to UTF-8 before sending to Manager. */
data = g_convert (data, -1, “UTF-8”, “ISO_8859-1”, NULL, &length, NULL);
while (sent < length)
{
int n = nsend (soc, data + sent, length - sent, 0);
if (n < 0)
{
if ((errno != ENOMEM) && (errno != ENOBUFS))
{
g_free (data);
return;
}
}
else
sent += n;
}
g_free (data);
}

I have edit my NVTs use UTF-8,because I want to surpport Chinese in my NVTs(like script_name and script_summary), what should I do?

Hi,

i have deleted your last “who can help me” posting for now. It is seen as bad netiquette to push a thread like this within a few hours without a response. Please have some patience and if some one knows an answer you should get an answer.

The rationale why no UTF-8 is currently supported is described in https://community.greenbone.net/t/vt-development/226:

Don’t use UTF-8 encoding for your VT. For the time being (as long as old scanner protocol OTP is supported), the encoding to be used for VTs is ISO-8859-1 .

Rationale: OTP is not encoding-safe.

Thanks,cfi. Because OTP is not encoding-safe, so VTs should use ISO-8859-1.Now, we can support chinese in VTs, We want to see the VTs information displayed in Chinese through gsad. What should we do?

Greenbone is working into this direction. OTP is going to be dropped in favor of OSP:

However, we are not receiving strong demands from chinese customers at the moment, so it is not a priority task to support chinese language in NVTs.

All you can do at the moment is to wait for GOS 6 where we will be a step closer to this.

1 Like

Thanks Jan. You said otp is a very old internal protocol between manager and scanner and It doesn’t solve the coding problem.I want to know why the otp protocol cann’t solve the coding problem in design.Can you tell me more about it? Thanks a lot!

i have the same question ,does osp protocol support utf-8?

I want to know whether the current GVM version supports UTF-8 coding. I wrote a third-party NASL in Chinese, which is displayed in garbled code on the page. I want to know whether there are any methods to solve it at present

NASL still doesn’t support UTF-8 and still requires ISO-8559-1 encoding because the openvas-scanner expects this encoding. All other components should use UTF-8.

1 Like

I have queried the data in redis and can display Chinese normally. The problem is that after OpenVAS scanner reads the redis data, the resulting data is not normally encoded in UTF-8. Gvmd supports UTF-8 encoding. When my newly created NASL file is read to the database by gvmd, it will be garbled

yes as i wrote openvas scanner is still expecting latin1 encoding in the nasl files. This can’t be changed easily at the moment.

1 Like

Because I’m from NASL_ Debugsecurity_ The Chinese returned in the message method is in fprintf (stdout, “”% s \ \ n ", DUP) of OpenVAS scanner; I want to know how OpenVAS returns data to gvmd in the next step. Is there any coding problem in this process