ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Procházka Lukáš Ing. - Pontex s. r. o." <LPr@pontex.cz>
To: "Hans Hagen" <pragma@wxs.nl>
Cc: ConTeXt <ntg-context@ntg.nl>
Subject: Re: UTF conversion via Lua (renaming attachments to .scr_)
Date: Thu, 16 Feb 2012 14:15:20 +0100	[thread overview]
Message-ID: <op.v9rwfuaytpjj8f@lpr> (raw)
In-Reply-To: <4F3CF1A9.6030904@wxs.nl>

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

On Thu, 16 Feb 2012 13:08:09 +0100, Hans Hagen <pragma@wxs.nl> wrote:

> no, although it's no big deal to provide that (of course there is then
> the matter of utf being more complete than the target)
>
>> ----
>> src_enc = "utf8"
>> tgt_enc = "cp1250"
>>
>> str = regimes.translate(str, src_enc, tgt_enc)
>> ----
>
> is there a reason not to stick to utf?
>
> Hans

Well - I'm working with a .cld document (with UTF encoding). There are some functions which typeset texts. And there is also a part which creates a .scr file.

.Scr files are sequences of AutoCAD commands - their contents are passed directly to AutoCAD command prompt.

When AutoCAD is creating a text entity, it reads the input stream (in our case: the .scr file) BYTE-PER-BYTE. When bytes represent a text to be drawn, unknown bytes (= bytes that don't have any graphical representation in AutoCAD font file ("shape" file in AutoCAD's terminology)) are shown as "?".

Of course, valid representation of language-specific-characters (like "čřž..." in Czech) requires an appropriate .shx (= "shape compiled") file.

Anyway, when AutoCAD is to write "č", it requires just ONE BYTE to be passed to it; so 2-byte UTF representation gives bad result (= "??").

So back to the origin, when I call the .cld's function that writes a command to the .scr file, I need to convert a UTF string back to CP 1250.

Would it be possible to provide this?

NB: There are two examples of .scr files; CP1250.scr works well in AutoCAD, the latter draws "????ST" instead of "ČÁST".

Kind reagrds,

Lukas


-- 
Ing. Lukáš Procházka [mailto:LPr@pontex.cz]
Pontex s. r. o.      [mailto:pontex@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

[-- Attachment #2: UTF.scr_ --]
[-- Type: application/octet-stream, Size: 60 bytes --]

_.TEXT _ST ROMAND _J _R _NON 14.48,0.0925 0.007 0.0 ČÁST

[-- Attachment #3: CP1250.scr_ --]
[-- Type: application/octet-stream, Size: 58 bytes --]

_.TEXT _ST ROMAND _J _R _NON 14.48,0.0925 0.007 0.0 ÈÁST

[-- Attachment #4: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2012-02-16 13:15 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-10 10:22 UTF conversion via Lua Procházka Lukáš Ing. - Pontex s. r. o.
2012-02-10 10:26 ` Thomas A. Schmitz
2012-02-10 10:57 ` Philipp Gesang
2012-02-10 11:11   ` Procházka Lukáš Ing. - Pontex s. r. o.
2012-02-10 11:14     ` luigi scarso
2012-02-13 11:42       ` Ulrike Fischer
2012-02-13 13:14         ` luigi scarso
2012-02-10 11:15     ` Wolfgang Schuster
2012-02-10 11:32       ` Procházka Lukáš Ing. - Pontex s. r. o.
2012-02-10 12:25         ` Wolfgang Schuster
2012-02-10 13:15           ` Procházka Lukáš Ing. - Pontex s. r. o.
2012-02-10 15:08             ` Hans Hagen
2012-02-16 11:13           ` Procházka Lukáš Ing. - Pontex s. r. o.
2012-02-16 12:08             ` Hans Hagen
2012-02-16 13:15               ` Procházka Lukáš Ing. - Pontex s. r. o. [this message]
     [not found]               ` <op.v9rwejuttpjj8f@lpr>
2012-02-16 22:56                 ` UTF conversion via Lua (renaming attachments to .scr_) Hans Hagen
2012-02-17  8:09                   ` UTF conversion via Lua Procházka Lukáš Ing. - Pontex s. r. o.
2012-02-17  8:19                     ` Hans Hagen
2012-02-17  9:20                       ` Procházka Lukáš Ing. - Pontex s. r. o.
2012-02-10 11:40       ` Procházka Lukáš Ing. - Pontex s. r. o.
2012-02-10 11:30     ` Philipp Gesang
2012-02-10 11:13   ` UTF conversion via Lua (now with attachment) Procházka Lukáš Ing. - Pontex s. r. o.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=op.v9rwfuaytpjj8f@lpr \
    --to=lpr@pontex.cz \
    --cc=ntg-context@ntg.nl \
    --cc=pragma@wxs.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).