* 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-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
1 sibling, 0 replies; 4+ messages in thread
From: Robert Millan @ 2008-02-01 21:48 UTC (permalink / raw)
To: The development of GRUB 2
On Fri, Feb 01, 2008 at 09:19:57PM +0000, Oleg Strikov wrote:
> 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?
The convention is to match the posix equivalents, then grub_strlen() for counting
bytes, so I'd suggest the first.
But, are you sure we don't have this already?
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: grub_cmdline_get() i18n problem
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
1 sibling, 0 replies; 4+ messages in thread
From: Yoshinori K. Okuji @ 2008-02-02 12:25 UTC (permalink / raw)
To: The development of GRUB 2
On Friday 01 February 2008 22:19, Oleg Strikov wrote:
> 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?
PROMPT is always in ASCII. This was my assumption. Is it bad?
Okuji
^ 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.