Title: Windows Live Agents: Matching international characters in XMLs
Slug: windows-live-agents-matching-international-characters-in-xmls
Date: 2008-03-10 16:03:00
Author: Kartones
Lang: en
Tags: Development, Windows Live Agents
Description: A guide on matching international characters in XMLs using Windows Live Agents.

 <p align="justify"><br>When we use XMLs, they come with UTF-8 encoding, so there is no problem in storing into them international characters, like for example the spanish word "España".</p> <p align="justify">We may have for example an XML with a list of countries written in spanish, and why not with first capital letter (for writing directly a country from the xml to the conversation window without uppercasing first letter ;).</p> <p align="justify">We create a subpattern and load it with that xml data:</p> <p align="justify"><font face="Courier New">subpattern CountriesSubPattern get Name, Name in CountriesTable {score=MACRO_STRONG_SCORE}</font></p> <p align="justify"> </p> <p align="justify">Testing our Agent we will detect that he doesn't understands "España" as a valid country.</p> <p>The problem is that loading XMLs we might have incorrectly setup the index property of the DataTable's parameter, or how the subpattern needs to receive the user input.</p> <p><font face="Courier New">datatable CountriesTable {expire="in 1 day"}<br>  load Name <b>{index=case-insensitive}</b> from datasource<br>    CountriesXMLFileLoader() </font> </p><p><font face="Courier New">subpattern CountriesSubPattern get Name, Name in CountriesTable <b>{style=raw}</b></font>  </p><p>For international characters, like spanish ones, we need "<i>style=raw</i>", because otherwise the Agent will use the thawed version (in the 4.3 SDK, "<i>España</i>" transforms into "<i>espan a</i>").</p> <p> </p> <p><b>Note</b>: This was a problem we recently had with the 4.3 version of the SDK, and just using XML files.<br>Using the Beta 5.0 SDK with a non-xml subpattern like the following the matching is perfect without adding properties:</p> <p><font face="Courier New">subpattern CountriesSubPattern<br>+ españa<br>+ inglaterra </font> </p><p><font face="Courier New">+ COUNTRY=CountriesSubPattern {score=MACRO_STRONG_SCORE}<br>- COUNTRY is a country</font>  </p><p><img src="https://images.kartones.net/posts/screenshots/windowsliveagents_subpatternmatching.png"></p>
