What's the default charset encoding used for CSP files?

Primary tabs

Pretty straight forward.

I'm tempted to hard-code ISO-8859-1 inside my VSCode extension when working with CSP because this seems to be the encoding used by default, but I need to know if there's any other possible configuration. So can you share your experience when working with CSPs? Like issues with encoding, discoveries regarding it, workarounds etc.

Also, can someone tell me if it's possible to work with UTF-8 encoded CSP files using Atelier without breaking the encoding of the output file?

  • 0
  • 0
  • 53
  • 2
  • 1

Answers

You can change the charset by setting this global:

set ^%SYS("CSP","DefaultFileCharset")="utf-8"

 

Ahh I see, and what does it assume if there's no value defined there? I just zwrite'd it to check if there was any.
Does it also modifies what the default Apache sets in the Content-Type?

Checking for the following lines in %CSP.Routine:

            If charset="" {
                Set charset=##class(%SYS.NLS.Table).GetCSPTable()
                If charset="" Set charset=$get(^%SYS("CSP","DefaultFileCharset"))
            }
            If charset'="" {
                If ##class(%Net.Charset).TranslateTableExists(charset) Set i%TranslateTable=##class(%Net.Charset).GetTranslateTable(charset)
            }

seems to mean that the RAW TranslateTable is used when none is located. Which charset does RAW defaults to?

EDIT: I checked your answer because you already gave me a lead. Also, looks like ISO-8859-1 is indeed RAW.

w ##class(%Net.Charset).GetTranslateTable("iso-8859-1")
RAW

It all depends on your locale.

In RUSW for example UTF8 is the default, bit  not in English locales.

You can also use ^NLS to check/modify the defaults.