XML encoding - handling foreign lang chars


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: XML encoding - handling foreign lang chars

  1. #1
    Lou Guest

    XML encoding - handling foreign lang chars


    My client application prompts the user for their full name. Since the
    user could be in France, for instance, the name could have non-US
    characters.

    The name is wrapped in XML and sent to an ASP on my server where I:
    set xmldoc = createobject("msxml2.domdocument.3.0") 'uses msxml3.dll
    xmldoc.load(Request)

    But this gives the error:
    An invalid character was found in the text context.

    I tried specifying a processing instruction on the client to set
    the encoding to "UTF-8" as the XML doc is built. Same error.
    Then I tried "UTF-16" and get the error:
    Switch from current encoding to specified encoding not supported.

    So, how do I handle these foreign language characters???
    Please email me: l_kvitek@audiblemagic.com
    Thanx!


  2. #2
    Russell Jones Guest

    Re: XML encoding - handling foreign lang chars

    Try this encoding when you're building the XML string.

    <?xml version="1.0" encoding="windows-1252"?>

    "Lou" <l_kvitek@audiblemagic.com> wrote in message
    news:3acbae31$1@news.devx.com...
    >
    > My client application prompts the user for their full name. Since the
    > user could be in France, for instance, the name could have non-US
    > characters.
    >
    > The name is wrapped in XML and sent to an ASP on my server where I:
    > set xmldoc = createobject("msxml2.domdocument.3.0") 'uses msxml3.dll
    > xmldoc.load(Request)
    >
    > But this gives the error:
    > An invalid character was found in the text context.
    >
    > I tried specifying a processing instruction on the client to set
    > the encoding to "UTF-8" as the XML doc is built. Same error.
    > Then I tried "UTF-16" and get the error:
    > Switch from current encoding to specified encoding not supported.
    >
    > So, how do I handle these foreign language characters???
    > Please email me: l_kvitek@audiblemagic.com
    > Thanx!
    >




  3. #3
    Lou Guest

    Re: XML encoding - handling foreign lang chars


    Tried 'Windows-1252', that gets (same error as UTF-8):
    An invalid character was found in the text context.


    "Russell Jones" <arj1@northstate.net> wrote:
    >Try this encoding when you're building the XML string.
    >
    ><?xml version="1.0" encoding="windows-1252"?>
    >
    >"Lou" <l_kvitek@audiblemagic.com> wrote in message
    >news:3acbae31$1@news.devx.com...
    >>
    >> My client application prompts the user for their full name. Since the
    >> user could be in France, for instance, the name could have non-US
    >> characters.
    >>
    >> The name is wrapped in XML and sent to an ASP on my server where I:
    >> set xmldoc = createobject("msxml2.domdocument.3.0") 'uses msxml3.dll
    >> xmldoc.load(Request)
    >>
    >> But this gives the error:
    >> An invalid character was found in the text context.
    >>
    >> I tried specifying a processing instruction on the client to set
    >> the encoding to "UTF-8" as the XML doc is built. Same error.
    >> Then I tried "UTF-16" and get the error:
    >> Switch from current encoding to specified encoding not supported.
    >>
    >> So, how do I handle these foreign language characters???
    >> Please email me: l_kvitek@audiblemagic.com
    >> Thanx!
    >>

    >
    >



  4. #4
    Russell Jones Guest

    Re: XML encoding - handling foreign lang chars

    Try the encoding "ISO-8859-1"

    "Russell Jones" <arj1@northstate.net> wrote in message
    news:3accb800@news.devx.com...
    > Try this encoding when you're building the XML string.
    >
    > <?xml version="1.0" encoding="windows-1252"?>
    >
    > "Lou" <l_kvitek@audiblemagic.com> wrote in message
    > news:3acbae31$1@news.devx.com...
    > >
    > > My client application prompts the user for their full name. Since the
    > > user could be in France, for instance, the name could have non-US
    > > characters.
    > >
    > > The name is wrapped in XML and sent to an ASP on my server where I:
    > > set xmldoc = createobject("msxml2.domdocument.3.0") 'uses msxml3.dll
    > > xmldoc.load(Request)
    > >
    > > But this gives the error:
    > > An invalid character was found in the text context.
    > >
    > > I tried specifying a processing instruction on the client to set
    > > the encoding to "UTF-8" as the XML doc is built. Same error.
    > > Then I tried "UTF-16" and get the error:
    > > Switch from current encoding to specified encoding not supported.
    > >
    > > So, how do I handle these foreign language characters???
    > > Please email me: l_kvitek@audiblemagic.com
    > > Thanx!
    > >

    >
    >




  5. #5
    Lou Guest

    Re: XML encoding - handling foreign lang chars


    Tried "ISO-8859-1", same error:
    An invalid character was found in the text context.

    "Russell Jones" <arj1@northstate.net> wrote:
    >Try the encoding "ISO-8859-1"
    >
    >"Russell Jones" <arj1@northstate.net> wrote in message
    >news:3accb800@news.devx.com...
    >> Try this encoding when you're building the XML string.
    >>
    >> <?xml version="1.0" encoding="windows-1252"?>
    >>
    >> "Lou" <l_kvitek@audiblemagic.com> wrote in message
    >> news:3acbae31$1@news.devx.com...
    >> >
    >> > My client application prompts the user for their full name. Since the
    >> > user could be in France, for instance, the name could have non-US
    >> > characters.
    >> >
    >> > The name is wrapped in XML and sent to an ASP on my server where I:
    >> > set xmldoc = createobject("msxml2.domdocument.3.0") 'uses msxml3.dll
    >> > xmldoc.load(Request)
    >> >
    >> > But this gives the error:
    >> > An invalid character was found in the text context.
    >> >
    >> > I tried specifying a processing instruction on the client to set
    >> > the encoding to "UTF-8" as the XML doc is built. Same error.
    >> > Then I tried "UTF-16" and get the error:
    >> > Switch from current encoding to specified encoding not supported.
    >> >
    >> > So, how do I handle these foreign language characters???
    >> > Please email me: l_kvitek@audiblemagic.com
    >> > Thanx!
    >> >

    >>
    >>

    >
    >



  6. #6
    Russell Jones Guest

    Re: XML encoding - handling foreign lang chars

    So what character is it that it's having trouble with? A little code would
    help.

    "Lou" <l_kvitek@audiblemagic.com> wrote in message
    news:3acce8b7@news.devx.com...
    >
    > Tried "ISO-8859-1", same error:
    > An invalid character was found in the text context.
    >
    > "Russell Jones" <arj1@northstate.net> wrote:
    > >Try the encoding "ISO-8859-1"
    > >
    > >"Russell Jones" <arj1@northstate.net> wrote in message
    > >news:3accb800@news.devx.com...
    > >> Try this encoding when you're building the XML string.
    > >>
    > >> <?xml version="1.0" encoding="windows-1252"?>
    > >>
    > >> "Lou" <l_kvitek@audiblemagic.com> wrote in message
    > >> news:3acbae31$1@news.devx.com...
    > >> >
    > >> > My client application prompts the user for their full name. Since

    the
    > >> > user could be in France, for instance, the name could have non-US
    > >> > characters.
    > >> >
    > >> > The name is wrapped in XML and sent to an ASP on my server where I:
    > >> > set xmldoc = createobject("msxml2.domdocument.3.0") 'uses

    msxml3.dll
    > >> > xmldoc.load(Request)
    > >> >
    > >> > But this gives the error:
    > >> > An invalid character was found in the text context.
    > >> >
    > >> > I tried specifying a processing instruction on the client to set
    > >> > the encoding to "UTF-8" as the XML doc is built. Same error.
    > >> > Then I tried "UTF-16" and get the error:
    > >> > Switch from current encoding to specified encoding not supported.
    > >> >
    > >> > So, how do I handle these foreign language characters???
    > >> > Please email me: l_kvitek@audiblemagic.com
    > >> > Thanx!
    > >> >
    > >>
    > >>

    > >
    > >

    >




  7. #7
    Lou Guest

    Re: XML encoding - handling foreign lang chars


    Doesn't matter which char since I cannot set any expectation on what
    is going to come in.

    I think I might have a solution.
    If I send in UTF-8, then have the ASP do a Request.BinaryRead to
    a variant array, convert that to string, then use xmldoc.loadXML(thestr)

    on a msxml3 doc. Seems to be working, still testing.
    Sound like a good workaround?
    It seems the load method cannot do the conversion, but loadXML can.


    "Russell Jones" <arj1@northstate.net> wrote:
    >So what character is it that it's having trouble with? A little code would
    >help.
    >
    >"Lou" <l_kvitek@audiblemagic.com> wrote in message
    >news:3acce8b7@news.devx.com...
    >>
    >> Tried "ISO-8859-1", same error:
    >> An invalid character was found in the text context.
    >>
    >> "Russell Jones" <arj1@northstate.net> wrote:
    >> >Try the encoding "ISO-8859-1"
    >> >
    >> >"Russell Jones" <arj1@northstate.net> wrote in message
    >> >news:3accb800@news.devx.com...
    >> >> Try this encoding when you're building the XML string.
    >> >>
    >> >> <?xml version="1.0" encoding="windows-1252"?>
    >> >>
    >> >> "Lou" <l_kvitek@audiblemagic.com> wrote in message
    >> >> news:3acbae31$1@news.devx.com...
    >> >> >
    >> >> > My client application prompts the user for their full name. Since

    >the
    >> >> > user could be in France, for instance, the name could have non-US
    >> >> > characters.
    >> >> >
    >> >> > The name is wrapped in XML and sent to an ASP on my server where

    I:
    >> >> > set xmldoc = createobject("msxml2.domdocument.3.0") 'uses

    >msxml3.dll
    >> >> > xmldoc.load(Request)
    >> >> >
    >> >> > But this gives the error:
    >> >> > An invalid character was found in the text context.
    >> >> >
    >> >> > I tried specifying a processing instruction on the client to set
    >> >> > the encoding to "UTF-8" as the XML doc is built. Same error.
    >> >> > Then I tried "UTF-16" and get the error:
    >> >> > Switch from current encoding to specified encoding not supported.
    >> >> >
    >> >> > So, how do I handle these foreign language characters???
    >> >> > Please email me: l_kvitek@audiblemagic.com
    >> >> > Thanx!
    >> >> >
    >> >>
    >> >>
    >> >
    >> >

    >>

    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center