On Fri, Jan 15, 2010 at 12:02 AM, J.C. Roberts <list-...@designtools.org>
wrote:
> On Thu, 14 Jan 2010 07:20:48 +0100 Tomas Bodzar
> <tomas.bod...@gmail.com> wrote:
>
>> I invoked 'xterm -lc' then 'setxkbmap -layout "us,cz" -option
>> "grp:shifts_toggle,grp_led:scroll"'.
>>
>> $ beaver
>>
>> entered some text in cz and save with name 'file'.
>>
>> $ file file
>> file: UTF-8 Unicode text, with no line terminators
>>
>> $ beaver file B  (no error during opening)
>>
>> Now I can see text, but diacritic characters are right of letters
>> instead of above them and one letter 'k' is even missing. gvim shows
>> garbage. It's same (output with badly placed diacritic) for these
>> options too :
>>
>> $ luit -v -encoding 'UTF-8' beaver file
>> UTF-8, non-ISO-2022 encoding.
>>
>> $ luit -v -encoding 'ISO 8859-2' beaver file
>> G0 is ASCII, G1 is Unknown (94), G2 is ISO 8859-2, G3 is Unknown (94).
>> GL is G0, GR is G2.
>>
>> Maybe I'm missing something obvious or I'm interpreting info from man
>> pages in a bad way.
>
>
> You'll need to forgive me for not knowing how to read, speak or even
> type in Czech. Yesterday, I looked up the keyboard mapping for Czech
> keyboards on wikipedia, built the beaver port, and tried to recreate
> your results, but my results were different.
>

It's ok. No one can know everything and I'm happy that someone helped
me with it. I was reading man page for xterm(1),  X(7) (I read it
whole and found 3 grammar bugs), luit(1), setxkbmap(1), xmodmap(1) and
so on, but in the end it was my fault and problem with app :-)


> The "with no line terminators" message from file(1) is normal and
> expected if, and only if, you created a file without any new lines
> (i.e. your file contains only a single line of text).
>

Yes. It was one line file. My fault as I wasn't test different file.
Sorry for that.


> I still haven't figured out how using multiple keyboard mappings really
> works (i.e. your `setxkbmap -layout "us,cz"`). The testing I did was
> with just the "cz" layout applied, (i.e. using `setxkbmap cz` --the
> same as `setxkbmap -layout "cz"`).

With my settings you can change keyboard layout by touching both Shift keys.


>
> I run OpenBSD -current, and since you didn't post your dmesg with this
> problem, I have no clue what you are running?

I use snapshots on my laptop and in VirtualBox at work too. This test
was in VirtualBox, but it's same on my laptop.

>
> Do you want to use UTF-8 ?
>
> Or do you want to use 8-bit, single byte, ISO 8859-2 ?
>

I want to use both because of my translations for OpenBSD project so I
can get CVS access and send updates by myself. I was doing it on Linux
or OpenSolaris, but now I will be working with OpenBSD and I will use
OpenBSD as only one OS on my laptop. In fact I don't need CZ for
normal work or use, but I need it for translations. I was able to read
CZ texts in Emacs without need for some modifications, but I don't
like Emacs. I prefer vi, vim, gvim or beaver. After my tests I was
able to read or write CZ texts, but read was possible only in Emacs.
In vi, vim, gvim, beaver I had garbage.

>
> As the luit(1) man page states:
> B  B  B  Luit B is B a B filter B that B can be run between an arbitrary
> B  B  B  application and a UTF-8 terminal emulator. B It B will B con-
> B  B  B  vert B application B output B from the locale's encoding into
> B  B  B  UTF-8, and convert terminal B input B from B UTF-8 B into B the
> B  B  B  locale's encoding.
>
> B  B  B  An B application B may also request switching to a different
> B  B  B  output B encoding B using B ISO 2022 B and B  ISO 6429 B  escape
> B  B  B  sequences. B  Use of this feature is discouraged: multilin-
> B  B  B  gual applications should be modified to directly B generate
> B  B  B  UTF-8 instead.
>
> By using luit(1), you are attempting to do a conversion from the
> encoding of your locale *_to_* UTF-8. I have no clue if this beaver
> editor can even handle UTF-8, so even if luit(1) is successful in doing
> the conversion to UTF-8 when saving, you might not be able to open the
> file afterwards. *** THIS seems to be the problem.
>
> If you want UTF-8 output, it's far better to use an application
> that actually has proper UTF-* multilingual support.
>

It's my fault as I thought thanks to output from file(1) that beaver
can do UTF-8. Of course that I know that there is no UTF-8 locale in
OpenBSD so I must use eg. uxterm(1).

> With vim/gvim you can easily set your desired encoding.
> B  B  B  B $ gvim
> B  B  B  B :set encoding=utf-8
>

Again my fault. I thought that gvim can display UTF-8 automatically as Emacs.

> If you want UTF-8 support/output in your terminal emulator (xterm), the
> best answer is to use uxterm(1). Similar to the -en option of xterm(1),
> using uxterm(1) will handle setting up your locale properly (i.e.
> setting the environment variables).
>
> ------------------------------------------------------
> Test #1
>
> B $ setxkbmap cz
> B $ uxterm
> B $ beaver
>
> So I create a new file and use some of the accented/diracritic
> characters in the "cz" layout, across a few lines of text. Then I save
> the file as "test4.txt" and test it with file(1).
>
> B $ file test4.txt
> B test4.txt: UTF-8 Unicode text
>
> So the creation of the file within beaver worked. BUT if I reopen the
> file with beaver, the accents/diacritics *FOLLOW* the characters rather
> than being above the characters. B --This is wrong and seems to be what
> you are reporting.
>
> Now, if I take that same exact file, "test4.txt," and open it in gvim,
> it *initially* looks like a mess, but if I set the encoding to UTF-8,
> then everything looks fine.
>
> B $ gvim test4.txt
> B :set encoding=utf-8
>
> There is nothing wrong with the UTF-8 file that was created, but since
> beaver cannot read UTF-8 files, that's where your problem is.
>
> ------------------------------------------------------
> Test #2
>
> Doing all of the above, but using `xterm -lc` rather than `uxterm` has
> the exact same results, namely, beaver can create a valid UTF-8 file,
> but it cannot open the resulting UTF-8 file.
>
> ------------------------------------------------------
>
> The short answer is this 'beaver' program is not able to handle UTF-8
> files. There are plenty of other text editors in the ports tree, and
> many of the big "desktop" packages (kde, gnome, xfce, ...) often have
> their own text editor.
>
> -- jon
>
>

Yes, correct. Everything works fine as you tested and as I tested
right now. Thanks a LOT. It will help some of my friends or another
people in future too.

Reply via email to