Webtextfield encoding issue?

  1. 5 weeks ago

    Tim S

    Jul 15 Pre-Release Testers, Xojo Pro Phoenix Arizona USA

    Hello all,

    A webtext field is populated with this data:
    0025_38B9_61B1_71FC. WD-WXG1A968Z4CL

    but instead, it displays this data.
    0025_38B9_61B1_71FC. <br><br>WD-WXG1A968Z4CL

    I think the problem is the encoding but I think it is a bit weird because the same code used to display in a windows app displays properly.

    If I am right and it is a text encoding issue, how do I correct this? Also, in debug mode, the IDE displays correctly as well.

    Thanks all.
    Tim

  2. Greg O

    Jul 15 Xojo Inc Somewhere near Raleigh, NC

    Not encoding. I'm guessing that you have two carriage returns in the middle.

  3. Tim S

    Jul 15 Pre-Release Testers, Xojo Pro Phoenix Arizona USA
    Edited 5 weeks ago by Tim S

    Hi Greg,
    At first glance, that is what I thought too. But here again, same code as what is used in a desktop app.

    This is the code used:

    sh.Execute("wmic DISKDRIVE GET SerialNumber")
        HDSerial = Trim(NthField(sh.Result, "SerialNumber",2))
    
        fldHD_Serial.Text = HDSerial

    In the debugger it shows the local variable HDSerial as 0025_38B9_61B1_71FC. WD-WXG1A968Z4CL
    How are spaces, or what *appears* as spaces, handled in a web app?

    Tim

  4. Michel B

    Jul 16 Pre-Release Testers, Xojo Pro
    Edited 5 weeks ago by Michel B

    @Tim S Hello all,

    A webtext field is populated with this data:
    0025_38B9_61B1_71FC. WD-WXG1A968Z4CL

    but instead, it displays this data.
    0025_38B9_61B1_71FC. <br><br>WD-WXG1A968Z4CL

    I think the problem is the encoding but I think it is a bit weird because the same code used to display in a windows app displays properly.

    If I am right and it is a text encoding issue, how do I correct this? Also, in debug mode, the IDE displays correctly as well.

    Thanks all.
    Tim

    This is not text encoding. In HTML, <br> means line feed.

    In spite of Desktop and Web using the same language, underlying code is VERY different. So what works in Desktop may sometimes not in Xojo Web.

  5. Greg O

    Jul 16 Xojo Inc Answer Somewhere near Raleigh, NC

    @Tim S Hi Greg,
    At first glance, that is what I thought too. But here again, same code as what is used in a desktop app.

    This is the code used:

    sh.Execute("wmic DISKDRIVE GET SerialNumber")
        HDSerial = Trim(NthField(sh.Result, "SerialNumber",2))
    
        fldHD_Serial.Text = HDSerial

    In the debugger it shows the local variable HDSerial as 0025_38B9_61B1_71FC. WD-WXG1A968Z4CL
    How are spaces, or what *appears* as spaces, handled in a web app?

    Tim

    Look at the binary representation. See if there are two chr(10) or chr(13) chars there.

  6. Greg O

    Jul 16 Xojo Inc Somewhere near Raleigh, NC

    Also, make sure the string's encoding is UTF8.

  7. Tim S

    Jul 16 Pre-Release Testers, Xojo Pro Phoenix Arizona USA

    Hi Greg,
    I tried this code, but same result - so not an encoding issue.

    Dim sHDSerial As String
    sHDSerial = HDSerial.ConvertEncoding(Encodings.UTF8)
    
    fldHD_Serial.Text = sHDSerial // HDSerial

    It was not a Chr(10) but it was a chr(13).

    Thanks for the help!

or Sign Up to reply!