On Thu, 16 Feb 2012 13:08:09 +0100, Hans Hagen <pra...@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:l...@pontex.cz]
Pontex s. r. o.      [mailto:pon...@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

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

Attachment: UTF.scr_
Description: Binary data

Attachment: CP1250.scr_
Description: Binary data

___________________________________________________________________________________
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 via email to