Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JL3It-0001zA-0F for mharc-grub-devel@gnu.org; Fri, 01 Feb 2008 16:20:07 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JL3Iq-0001xa-W7 for grub-devel@gnu.org; Fri, 01 Feb 2008 16:20:05 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JL3Io-0001vO-V5 for grub-devel@gnu.org; Fri, 01 Feb 2008 16:20:04 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JL3Io-0001vH-RK for grub-devel@gnu.org; Fri, 01 Feb 2008 16:20:02 -0500 Received: from wa-out-1112.google.com ([209.85.146.180]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JL3In-0003JO-9B for grub-devel@gnu.org; Fri, 01 Feb 2008 16:20:02 -0500 Received: by wa-out-1112.google.com with SMTP id k34so760101wah.10 for ; Fri, 01 Feb 2008 13:19:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; bh=+OII05CvqusegUbRoM+kAJYA34eYnMh+PDmw8fxig00=; b=cF/2izNfizJuXdpGRGBbHrtl1QC6l6gkFzn0uDwAAZ5+fT4UTYElo7RVUJ77sap+k2YvwyJkIsYgWprkJp69miCT9UX76u4ocgcXLG4mhNTI5WTY1Qp2CBFwWDfOrjCVjxuph6QBZgx+hPBSO1zsexAcJ2ALD4XgO9cdguZ5h8U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=Ss0gFK4pMp1a4YYGIiOvr72Lr0OCw10l1TLQCZyS5G7Zt9lVMRySRC3TzQ0EWMX6LzO0Jg5ppu2/9XH5RgIJu1pPmG/6L9HtbmOBLtF1h7aSK23Cr5cWXg0lya4kAw/msrTYTMKb/MlYl2fXKqHNLSyecLfjM9+uiUZ7YI+xm7U= Received: by 10.114.194.1 with SMTP id r1mr4555728waf.40.1201900797916; Fri, 01 Feb 2008 13:19:57 -0800 (PST) Received: by 10.114.255.15 with HTTP; Fri, 1 Feb 2008 13:19:57 -0800 (PST) Message-ID: <94a0ccbc0802011319v21f1904aj628bebc48a614bf6@mail.gmail.com> Date: Fri, 1 Feb 2008 21:19:57 +0000 From: "Oleg Strikov" To: grub-devel@gnu.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_34289_29935043.1201900797902" X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Subject: grub_cmdline_get() i18n problem X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Feb 2008 21:20:05 -0000 ------=_Part_34289_29935043.1201900797902 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 ------=_Part_34289_29935043.1201900797902 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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
------=_Part_34289_29935043.1201900797902--