All of lore.kernel.org
 help / color / mirror / Atom feed
* grub_cmdline_get() i18n problem
@ 2008-02-01 21:19 Oleg Strikov
  2008-02-01 21:48 ` Robert Millan
  2008-02-02 12:25 ` Yoshinori K. Okuji
  0 siblings, 2 replies; 4+ messages in thread
From: Oleg Strikov @ 2008-02-01 21:19 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 685 bytes --]

Good day!

Let's look at grub_cmdline_get() func code:

/* normal/cmdline.c  - line 300 */
plen = grub_utf8_strlen (prompt);
  lpos = llen = 0;
  buf[0] = '\0';

  if ((grub_getxy () >> 8) != 0)
    grub_putchar ('\n');

  grub_printf (prompt);

  xpos = plen;

Idea is very simple - we move cursor `plen` times.
All is OK when `promt` contains only ASCII symblos. If we use UTF8 strings -
we get incorrect cursor moving (grub_strlen returns incorrect length due to
UTF-8 symbol floating byte size).
There are two ways:
* encode smth like grub_utf8_strlen ()
* modify grub_strlen () func and add this feature

I do my best to solve this problem, but what way do you recommend?

Thanks

[-- Attachment #2: Type: text/html, Size: 849 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: grub_cmdline_get() i18n problem
@ 2008-02-03 13:00 Oleg Strikov
  0 siblings, 0 replies; 4+ messages in thread
From: Oleg Strikov @ 2008-02-03 13:00 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

>
> PROMPT is always in ASCII. This was my assumption. Is it bad?
>
> Okuji
>

Possibly, it is not so bad, but unexpectedly.
It seems (e.g. to me) that grub_cmdline_get() simply makes grub_printf()
call (without any `byte length` restrictions).

Furthermore, if user wanna make `i18n prompt request` in his native language
module we incline him to use separate grub_printf() & grub_cmdline_get("" -
prompt) calls.

[-- Attachment #2: Type: text/html, Size: 618 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-02-03 13:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-01 21:19 grub_cmdline_get() i18n problem Oleg Strikov
2008-02-01 21:48 ` Robert Millan
2008-02-02 12:25 ` Yoshinori K. Okuji
  -- strict thread matches above, loose matches on Subject: below --
2008-02-03 13:00 Oleg Strikov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.