specify character encoding (e.g. UTF-8)

495 views
Skip to first unread message

Akashdeep Kasaodhan

unread,
Mar 16, 2016, 1:11:18 AM3/16/16
to Caché, Ensemble, DeepSee
Hi,

While writing to a file in Cache, is there a way to specify which character encoding (like UTF-8) the file takes?
Also, Is there is a default character encoding which all files take.

regards,
Akash

Dmitry Maslennikov

unread,
Mar 16, 2016, 6:27:50 AM3/16/16
to Caché, Ensemble, DeepSee
Default encoding depends on installation, in installations process, you should choose 8-bit or Unicode. While install Ensemble, you can't do so, every installations will be Unicode.
To check it, you can look at
w $system.Version.IsUnicode()
or by letter U in Build number in $zv
Cache for UNIX (Apple Mac OS X for x86-64) 2016.1 (Build 646U) Fri Feb 5 2016 13:21:22 EST
and you can get actual current coding page by command
write $$GetIO^%NLS()
UTF8

If you need to control in which coding page will be written file, you may use %Stream.FileCharacter and it's TranslateTable property
    set fs=##class(%Stream.FileCharacter).%New()
    set fs.Filename="/tmp/temp.txt"
    set fs.TranslateTable="UTF8"
    do fs.Write("Caché")
    do fs.%Close()
    set sc=fs.%Save()

--
--
Caché, Ensemble, DeepSee

---
You received this message because you are subscribed to the Google Groups "Caché, Ensemble, DeepSee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to intersystems-publi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Dmitry Maslennikov
Lead Programmer at LETOGRAF
Skype: DAiMor

John Murray

unread,
Mar 16, 2016, 6:36:47 AM3/16/16
to Caché, Ensemble, DeepSee
On your OPEN command's mode parameters, use the "K" letter code or the /TRANSLATE and /IOTABLE keywords. See http://docs.intersystems.com/cache20152/csp/docbook/DocBook.UI.Page.cls?KEY=GIOD_rmsseqfiles

For more information, including about defaults, I suggest you start at http://docs.intersystems.com/cache20152/csp/docbook/DocBook.UI.Page.cls?KEY=GORIENT_ch_localization

John
Reply all
Reply to author
Forward
0 new messages