Page 1 of 1

ASCII Deprecation

Posted: Sun Nov 01, 2015 10:17 pm
by ANDY ANDERSON
Maybe one of the top fellows will answer this.

When ASCII support is deprecated, does that mean that one will not be able to
read or write ASCII to or from files ?

If so, there may be a problem. I write specialized accounting applications
having to do with U.S. government billing such as Medicare and Medicaid.
The HIPAA 5010 required standard is ASCII for data files sent or received.

So am I out of luck ?

Thanks in advance.

Re: ASCII Deprecation

Posted: Sun Nov 01, 2015 10:32 pm
by helpy
See blog post of freak: http://www.purebasic.fr/blog/?p=452

Re: ASCII Deprecation

Posted: Sun Nov 01, 2015 11:09 pm
by ElementE
ANDY ANDERSON wrote:When ASCII support is deprecated, does that mean that one will not be able to
read or write ASCII to or from files ?
The PB functions ReadString and WriteString both have optional format flags that let you specify the format (Ascii, UTF-8, Unicode) of the data to be read or written.

Re: ASCII Deprecation

Posted: Mon Nov 02, 2015 1:57 am
by Keya
seeing as its nearly Christmas, is there a "Using Ascii strings from Unicode-compiled PB apps" guide?!? that would help make the Ascii->Unicode transition less scary :)

Re: ASCII Deprecation

Posted: Mon Nov 02, 2015 5:24 pm
by ANDY ANDERSON
@ElementE

I am aware of the ReadString, WriteString and various file open commands with
the #PB_Ascii flag.

The question is whether this flag will be supported in the releases after ASCII
deprecation.

Re: ASCII Deprecation

Posted: Mon Nov 02, 2015 5:32 pm
by skywalk
Briefly, the deprecation is Ascii compile. Meaning, native strings will be Unicode.
The commands will still support the #PB_Ascii switch and there will be additional functions for ToAscii(), ToUni(), etc.
But, if you read file contents using #PB_Ascii switch and assign to a PB string variable, it will now be a Unicode string.

Re: ASCII Deprecation

Posted: Mon Nov 02, 2015 5:36 pm
by IdeasVacuum
The flags will indeed continue to be supported. Fred's post:
http://www.purebasic.fr/english/viewtop ... 14&t=60171

Re: ASCII Deprecation

Posted: Mon Nov 02, 2015 7:01 pm
by helpy
As you can read in the blog post:
...

So we decided to remove the ability to compile in ascii mode in the PB version that follows after the next LTS version (that is, the LTS version coming after the 5.2x LTS cycle ends).

...

No changes will be made to the language or data types (The .c, .a and .u as well as the pseudo-types and library commands will remain as they are). The only difference is that the “compile in unicode mode” switch in the compiler will be permanently set to “on”.

...

Re: ASCII Deprecation

Posted: Mon Nov 02, 2015 11:03 pm
by ANDY ANDERSON
@skywalk, IdeasVacuum and helpy

Thanks, I feel better now. I'm 72 years old and plan to retire at 75.
So 64 bit ASCII will probably carry me through.

But if for some stupid reason, I decide to continue coding to senility,
the functions you mentioned will provide a work around when 128 bits
becomes the norm.

Thanks, again.

Re: ASCII Deprecation

Posted: Mon Nov 02, 2015 11:23 pm
by ElementE
Fred gave the practical implications of the change when he wrote the following:
  • - Basically, if your software runs with the "unicode" swith ON, nothing will change, you can skip the following text :). If not, then you can enable it and test it.
    - All strings in PB will be handled as UCS2 (16-bit) strings internally. So if you used "@String$" somewhere in your code, change are high it won't work anymore (if dealing which an API for example)
    - We plan to provide 2 new functions, to ease things a bit:
    *AsciiBuffer = ToAscii(String$)
    *UTF8Buffer = ToUTF8(String$)
So if we get our programs all tested and working now in Unicode Mode, we should be safe.