String to Text question re encodings

  1. 4 weeks ago

    Ralph A

    Dec 29 Santa Monica, California
    Edited 4 weeks ago

    In the past, I thought I had to make sure code like

    MyRecordSet.Field("FirstName").StringValue.ToText

    had to include reference to encodings, like

    MyRecordSet.Field("FirstName").StringValue.DefineEncoding(Encodings.UTF8).ToText

    Otherwise I would get a runtime error. But this no longer seems necessary. Has something changed in Xojo with respect to this?

    Using Xojo 2017r3.

  2. Kem T

    Dec 29 Pre-Release Testers, Xojo Pro, XDC Speakers New York

    It must mean the encoding is already defined.

  3. Tim S

    Dec 29 Canterbury, UK

    @Ralph A In the past, I thought I had to make sure code like

    MyRecordSet.Field("FirstName").StringValue.ToText

    had to include reference to encodings, like

    MyRecordSet.Field("FirstName").StringValue.DefineEncoding(Encodings.UTF8).ToText

    Otherwise I would get a runtime error. But this no longer seems necessary. Has something changed in Xojo with respect to this?

    Using Xojo 2017r3.

    I think for this the default encoding is UTF8 so nothing extra needed. See

    http://docs.xojo.com/DatabaseField.StringValue

  4. Ralph A

    Dec 29 Santa Monica, California

    This seems odd. I definitely used to get a runtime error because of not referencing encoding in such a situation. But now I don't. I do see now in the documentation that the default encoding is UTF8 when extracting StringValue from a SQLite database, which is what I'm doing here. Perhaps this became the default in a recent version of Xojo.

    Or perhaps I saw this runtime error when using StringValue.ToText to extract data from a nonTEXT field in SQLite (e.g., an INTEGER field).

or Sign Up to reply!