Easy accent (special character) translation to html numeric codes with xdk.

Hi, I have an xml (obtained via xsql) with the correct special characters (spanish accents in this case), I got it in a servlet like:
                                        XSQLRequest req = new XSQLRequest(pageUrl);
XMLDocument xsqlDoc = (XMLDocument)req.processToXML(params);
XSLProcessor processor = new XSLProcessor();
processor.setBaseURL(xslUrl);
XSLStylesheet sheet = processor.newXSLStylesheet(xslUrl);
processor.processXSL(sheet, xsqlDoc, out);
This works fine, I got a pretty xml document like:
<BLOQUE_B>
<ROW num="1">
<TITULO>Trabajos Topográficos Catastrales.</TITULO>
<TITULO_RESTO>PolÃgono núm. 6</TITULO_RESTO>
<RESPONSABILIDAD>Servicio de Catastro Topográfico Parcelario;</RESPONSABILIDAD>
<ESCALA>Escala 1:5000</ESCALA>
<FRASE_INTRODUC>Versión original</FRASE_INTRODUC>
<DESCRIPCION_FISICA>1 plano</DESCRIPCION_FISICA>
</ROW>
</BLOQUE_B>
The problem comes with the special characters (accents), I need to output as html codes:
á --> &amp;#225;
é --> &amp;#233;
etc ...
I've try with xdk 10 (xls v2), using the new character-map funcion, but it didn't work. (applying version="2.0" in the stylesheet and processor.setXSLTVersion(oracle.xml.parser.v2.XSLProcessor.XSLT20)
in the servlet), (example in xml.com: http://www.xml.com/pub/a/2004/06/02/tr-xml.html)
With xdk 9 (xls v1), I try with a string-replace template function (like the http://www.dpawson.co.uk/xsl/sect2/StringReplace.html), and it seens to work.
It's there an easy way to make this?
Why didn't work the character-map with xdk10 (xls v2))
Thanks in advance
Felipe Llano

I found a solution, without using xsl, just with the jtidy library, as I need the translation via servlet, I did it with just a few lines like:
PrintWriter out = response.getWriter();
XSQLRequest req = new XSQLRequest(pageUrl);
XMLDocument xsqlDoc = (XMLDocument)req.processToXML(params);
ByteArrayOutputStream out2 = new ByteArrayOutputStream();
ByteArrayOutputStream out3 = new ByteArrayOutputStream();
xsqlDoc.print(out2);
Tidy tidy = new Tidy();               
tidy.setXmlTags(true);
tidy.setXmlOut(true);
tidy.parse(new ByteArrayInputStream(out2.toByteArray()), out3);
out.print(out3.toString() );

Similar Messages

  • Convert HTML ASCII codes with JSTL and Apache Taglibs?

    I am building a web application using JSTL and some of the Apache Taglibs, so these are the taglibs I have at my disposal currently. What I am looking for is the ability to handle the &#039; that appears in submitted search strings which contain the ' character. SQL seems to be able to handle other special characters (such as &, [, ", etc) but I can't get it to get along with the &#039;.  I have tried using a <string:replace replace="&#039;" with="\&#039;"> to escape the &#039;, but this doesn't seem to work either.  Any suggestions?  Let me know if you need more information to be able to fully understand the situation.
    --Ioeth                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    By the way, the search string that a user enters is getting Tokenized using " " as the token and then fed directly into multiple SQL LIKE comparisons based on how many tokens were found.

  • Need to prevent special character in generated XML file

    Hello,
    I am using E-business Suite 12.1.3 and XML version 5.6.3.
    My XML file is ending up with a special character (a Latin capital letter U with circumflex) at the end, after the final closing tag.
    Due to this the concurrent program that needs to output the XML is ending with warning.
    My XML file is produced using a PL/SQL procedure, as follows (I've simplified it):
    FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<?xml version="1.0" encoding="UTF-8" ?>');
    FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<DOCS>');
    FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<LETTER>');
    FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<EMP_NAME>Michaela Hart</EMP_NAME>');
    FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'</LETTER>');
    FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'</DOCS>');
    But when I run the concurrent request that creates the output then try to view the output in Internet Explorer I get the following error:
    Invalid at the top level of the document. Error processing resource 'http://servername.domain...
    </DOCS>
    If I view the source of the page in Internet Explorer it shows a square after </DOCS> indicating the special character that has been added.
    I checked this by looking at the output file in unix (cat -v o7766582.req) and it showed up the Latin U character.
    I realise it could be to do with the character set I am using. I checked what we had on the server:
    > echo $NLS_LANG
    American_America.UTF8
    I would have thought that corresponded with the XML declaration character set but I'm not sure.
    Does anyone have any other ideas about why I have this special character, and how it could be removed?
    Thanks in advance,
    Hazel

    Hi AlexAnd,
    thanks very much for your reply.
    I'm now unable to recreate the problem since dbms_xmlgen worked. If I switch back to my previous method it works fine!
    I'm not sure your suggestion would help, as there were no special characters in the data, the special character was added after the last tag I output. I hard coded the data (as in my example) for testing purposes so there was no SQL in use and the special character was still added at the end of the XML output. But I will definitely give it a try if I get the problem again.
    I had the idea that maybe I should have been using FND_FILE.PUT rather than FND_FILE.PUT_LINE but now the error is gone I can't tell if that would have solved the problem either.
    I appreciate your input.
    Regards
    Hazel

  • Biztalk error if "&" special character is used from Oracle Database

    There is an error when system was received data form Oracle database. The data format is including "&"....etc special character. Becuase of the error appear between Oracle database and receive port. I can't do anything in Biztalk program to
    encode the message. Does any way to do encoding when biztalk receive data?
    xlang/s engine event log entry: Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'ECT.TOSToEDB.orcWorkingTable(7e2c77ec-adb6-5790-29ad-835ec8374c1d)'.
    The service instance will remain suspended until administratively resumed or terminated.
    If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.
    InstanceId: 8eb4cb36-82b2-4d34-9b45-64b8aba23758
    Shape name:
    ShapeId: 09bc980e-3040-4238-a838-f3606294effe
    Exception thrown from: segment 1, progress 84 Inner exception: An error occurred while parsing EntityName. Line 4, position 112.
    Exception type: XmlException
    Source: System.Xml
    Target Site: Void Throw(System.Exception) The following is a stack trace that identifies the location where the exception occured
       at System.Xml.XmlTextReaderImpl.Throw(Exception e)
       at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
       at System.Xml.XmlTextReaderImpl.ParseEntityName()
       at System.Xml.XmlTextReaderImpl.ParseEntityReference()
       at System.Xml.XmlTextReaderImpl.Read()
       at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
       at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
       at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
       at System.Xml.XmlDocument.Load(XmlReader reader)
       at System.Xml.XmlDocument.LoadXml(String xml)
       at ECT.TOSToEDB.orcWokingTableCheck.segment1(StopConditions stopOn)
       at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)
    For more information, see Help and Support Center at
    http://go.microsoft.com/fwlink/events.asp.

    There are 5 special characters which in xml   & < > "  '  if the Oracle fields contain any of those characters it will cause invaild xml.
    This can be solved at the oracle side be replacing the special characters by it's  html encode equivalent, so  & becomes &amp; , I think the best way to solve it
    is to make a custom pipeline component and translate the special characters there.
    There is my Send Port Properties. Do you mean the default biztalk pipeline component ("XML Receive") cannot translate any special characters?

  • Special character: é

    How can you have special character é show-up properly when exported to a website using Muse?

    If accented characters are not displaying correctly on your live site, either the method you used to upload the site to your hosting provider wasn't properly configured to support UTF-8 Encoded Unicode text files (the .html files) or the hosting provider's server is not properly configured to server up UTF-8 Encoded Unicode text files.
    Assuming you're not using the built-in Upload to FTP Host functionality in Muse, I recommend using Filezilla.
    If you're using the built-in Upload to FTP Host functionality or already using Filezilla, then I recommend you discuss the issue with your hosting provider.

  • Special Character to convert to Space

    I have a field in BI "zpustreg" which has values with - and # which is not allowing me to load the data to cube so I am writing this code in transformation to convert any special character to space. but it is having error if you can help me fix the code below would really appreciate it
    Abap Code to Load ZPUSTREG
    METHOD compute_ZPUSTREG.
    IMPORTING
    request type rsrequest
    datapackid type rsdatapid
    SOURCE_FIELDS-/BIC/ZPUSTREG TYPE /BIC/OIZCUSTREG
    EXPORTING
    RESULT type tys_TG_1-/BIC/ZPUSTREG
    DATA:
    MONITOR_REC TYPE rsmonitor.
    $$ begin of routine - insert your code only below this line -
    ... "insert your code here
    *DATA:Monitor_REC TYPE rsmonitor.
    DATA:L_D_OFFSET LIKE sy-index.
    CONSTANTS:c_allowed(60) TYPE c.
    Value `ABCDEFGHIJKLMNOPQRSTUVWXYZ!"%&'()*+,-/:;<=>?_0123456789_’.
    RESULT = SOURCE_FIELDS-/BIC/ZPUSTREG
    TRANSLATE RESULT TO UPPER CASE
    DO 60 TIMES.
    L_d_offset = sy-index – 1.
    IF RESULT+1_offset(1) CO c_allowed.
    Else.
    RESULT+1_d_offset(1) = ` ’.
    ENDIF.
    ENDDO.
    ENDMETHOD.
    E:Statement "VALUE" is not defined. Check your spelling. spelling.
    E:Unable to interpret "C". Possible causes of error: Incorrect spelling
    Thanks
    Soniya

    Also, you'll need to change in this line:
    RESULT+1_d_offset(1) = ` ’.
    the ` for a  ’
    Have you maintained the RSKC transaction? If you put ALL_CAPITAL there it should allow you to use those characters.
    Regards,
    Diego

  • Request.getParameter(): special character handling problem

    Hello, there:
    This should be an easy question for the gurus in here.
    I use a string attached to the url as the parameter string, which includes spaces. the system automatically converts them to %20, but when I receive them in my servlet using request.getParameter, a special character, &Acirc; appears; I couldn't proceed with it.
    I suppose this is a common problem but seems that I didn't find topics about it on this forum.
    So anyone can help? Any encoder/decoder APIs to handle it?
    Thanks a lot,
    Sway

    hi,
    escape can solve ur problem
    use js function to submit form like
    function subForm()
    var any_spcl_value ="kdfhjdf$%@#$% 2FGSFG @%@#%@# V";
    mainForm.action = "index.jsp?value="+ escape(any_spcl_value);
    mainForm.submit();
    and use request.getParameter("value");
    u ll get kdfhjdf$%@#$% 2FGSFG @%@#%@# V as it is.
    AE

  • How do I get Special character Euro symbol € to display ?

    Hi,
    How do I get the euro symbol € to display in Flash from
    PHP file created in DW ?. It does not display it properly. I have
    simplified the PHP code I have is:
    <?php
    $msgtoflash = "This is the Euro Symbol &#8364";
    print ("&Databaseinfo=$msgtoflash");
    ?>
    The &#8364 is a special character code for HTML.
    If I use the $ or £ symbols it works perfectly but not
    € ?
    Thanks,
    Paul

    maith wrote:
    > Im using Actionscript2. I had placed a query in Flash in
    "General
    > Discussions", before I came on the Dreamweaver Forum,
    but got no reply.
    The way to get the euro symbol to display in Flash is to use
    XML. I have
    tested this, and it works:
    euro.php
    <?php
    header('Content-type: text/xml');
    echo '<root>
    <elem>This is the euro symbol:
    &#8364;</elem>
    </root>';
    ?>
    ActionScript 2.0 to display the value of <elem> in a
    dynamic text field
    called myText:
    var myXML:XML = new XML();
    myXML.ignoreWhite = true;
    myXML.onLoad = handleLoad;
    myXML.load('
    http://localhost/test/euro.php');
    function handleLoad(success) {
    if (success) {
    var theRoot:XMLNode = this.firstChild;
    myText.text = theRoot.firstChild.firstChild.nodeValue;
    } else {
    myText.text = 'Not working :(';
    Handling XML in ActionScript 2.0 is like poking needles in
    your eyes,
    but it's the only way I have been able to get the euro symbol
    from an
    external source into a Flash movie.
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • How to Eliminate Special Character in SQL LOADER Script

    How to eliminate special character from SQL LOADER script file which suppose not to insert in TABLE
    example.CSV lile like this
    <ABC/ , 7747>
    <DEF/ , 7763>
    <NEW/ , 7779>
    <OLD/, 7795>
    I have to remove < > and / character at the time of loading into table. How It could be done. It is not possible to remove < , > , / character manually from CSV file

    On Unix/Linux that's very easy, on Windows... I don't know...
    $ cat myfile.csv
    <ABC/ , 7747>
    <DEF/ , 7763>
    <NEW/ , 7779>
    <OLD/, 7795>
    $ tr -d "\057\074\076" <myfile.csv >outfile.csv
    $ cat outfile.csv
    ABC , 7747
    DEF , 7763
    NEW , 7779
    OLD, 7795
    $

  • Special Character in Filename script - how do I escape it.

    Hello All. I'm attempting to call a file in sqlplus on a linux box. The file name has a special character.
    ex: i$_my_script.sql
    I've attempted to use
    @i$_my_script.sql
    @i\$_my_script.sql
    @i\\$_my_script.sql
    @"i$_my_script.sql"
    @'i$_my_script.sql'
    @'i\$_my_script.sql'
    All to no avail. I could have sworn I'd called a similar file with $ in the filename before but now I can't get it to work. Preference would be to no have a special character in the filename ... but the file is coming in from a source I don't have control over. I could rename the file but the file resides in a source control system and I'd prefer not to have to rename it every time I want to compile it.
    Thanks in advance.
    edit<<Also as a note I can see the file in sqlplus by sending ls to the command line as follows:
    SQL> ! ls i\$_my_script.sql
    which returns
    i$_my_script.sql
    Edited by: Kennedy on Sep 6, 2011 1:25 PM

    another workaround for the same is use double slash \ \ before special character to avoid such issue
    Regards,
    CA
    shockwave flash chrome
    clear flash cookies
    html blinking text
    keyboard on screen

  • Special Character error in IDOC

    All,
    I am trying to upload PO data using IDOC type "PORDCR1" from LSMW. All is well till I convert data. We have some speical characters in short text field at item level and even when I convert the data and display it from LSMW it looks fine, but when I processing idoc it's erroring out meaning if I have special character "Á" in IDOC during processing it's getting converted to "Á#" and it's screwing up the positions.
    What I am not able to understand is when I am displaying the converted data in segment mode in LSMW it's getting displayed perfectly without extra "#", but when I am checking errored idoc from WE05 it has this new #. Did anyone come across this issue?
    Your help will be greatly appreciated. Thanks for your time.

    Ok, the issue was with LSMW port (which was not marked as UNICODE) and because of which it's not translating special characters....

  • Problem in dealing with special-character filename

    Hi,
    I am facing a weird problem while dealing with a file which has a special character in its name. That character is the big-hyphen, i.e. '–' (not the normal hyphen we can type from keyboard), you would have seen this character in MS Word.
    My java program is running on HP-UX OS, and its basically trying to copy this file to a Windows target system through socket. But while executing it, I am getting Broken Pipe Exception.
    I am applying UTF-8 encoding while running my program (by specifying the argument "-Dfile.encoding=UTF-8" in the java process), and I am also confirming that the file-encoding is being applied to UTF-8 properly by putting a debug in the beginning of the program. My understanding is UTF-8 supports all the characters exist in this world.
    Any suggestion / pointers would be really appreciated.
    Thanks,
    Rajiv

    Fine..... but is there any way to know which encoding has been applied on it ..
    Let's say if you create any file on unix-based system in any application, which encoding gets applied there by default ?
    This file is basically nothing but an html page created using 'Save As' from the browser.
    The person who has created the file is a non-technical .. and won't know much about this all stuff... encoding etc.

  • Special Characters in imported HTML

    I've got a Flash piece where the user fills out a
    questionnaire, and based on their responses, they are shown a
    handful of recommendations. These recommendations are all separate
    HTML files that load into a scrolling text field as HTML text.
    There is an English version and a Spanish version. The
    English version works fine.
    In the Spanish version, on the other hand, we've got special
    characters such as accents over e's, tildes over n's, and so forth.
    In the HTML, I've used codes for special characters, such as
    &ntilde; for ñ. That didn't work. In the resulting
    recommendations, this code appears, not the ñ.
    Then I tried just putting the special characters into the
    HTML, without the special code. That looks fine on my computer (Mac
    G5 running Firefox), but on Windows IE instead of the special
    characters, we get one of those diamond shapes with a "?" in the
    middle of it.
    In my recommendations field, I have it set to embed all
    characters. The font is Verdana, which should include the special
    characters. Does anyone know if the display of special characters
    in Flash is possible, and how I would do it?

    add <?xml version="1.0" encoding="UTF-8"?> tag to 1st
    line of your xml, AND
    save your xml file encoding as utf-8, if you are using
    notepad, try this:
    - save as, change the encoding (the bottom field) to UTF-8
    no worry about your file extension.
    UTF-8 (8-bit Unicode Transformation Format) supports multiple
    languages.
    good luck

  • SharePoint key word query, how does the "Query Text" query special character in a query variable?

    I have a no code sandbox solution, in a content by search web part, I want to return pages from the library except the page I am visiting.
    I have 2 pages:
    Page A, the title is: Page title without special character
    Page B, the title is: Page title with special character "a b c d ..."
    And then I use Title<>{Page.Title} in the query text of the CSWP.
    While I visit Page A, the CSWP returns Page B, it works as expected.
    But while I visit Page B, the CSWP returns nothing, expected result should be Page A. I just consider, whether the special characters in the Title of Page B breaks the query text.
    I can not find similar topics in the forum, Does anyone have idea?
    Many thanks!

    Thank you for your feedback, Daniel.
    I have some updates, and found the root cause: if the field value contains special characters, the CSWP will not render the double quotation marks around the field value.
    View the page html source, and then find the text "QueryModification", you will see what happen:
    Query Text Input: Title<>{Page.Title}
    1. While the page title is "Test Page 1" (without special character), the rendered query text is
    Title<>\"Test Page 1\". It works as expected.
    2. While the page title is "Test-Page-1" (with special character "-", of cause we have more special characters on production), the rendered query text is
    Title<>Test-Page-1.  The double quotation marks are not rendered by the CSWP, so the query text are broken. It does not work as expected.
    If I make the query text as Title<>"{Page.Title}"
    1. While the page title is "Test Page 1", the rendered query text is
    Title<>\"\"Test Page 1\"\". It does NOT work since the
    quotes are duplicated (no sure why CSWP duplicates the quota mark),
    2. While the page title is "Test-Page-1", the rendered query text is
    Title<>\"Test-Page-1\".  Quotes are correct, but it does NOT work as expected still.
    The expected rendered query text (view from the html source) should be
    Title<>\"Test\\\-Page\\\-1\". (Here is test url: <a href="http://server/_api/search/query?querytext='Title<>"Test%5c%5c%5c-Page%5c%5c%5c-1"'&rowlimit=10">http://server/_api/search/query?querytext='Title<>"Test%5c%5c%5c-Page%5c%5c%5c-1"'&rowlimit=10)
    From the above information, I can say the CSWP not handle the special character correctly ("\" is not inserted before any special charactor).
    Is there any setting in CSWP can be used to resolve above problem?

  • Replace Non-Numeric Characters with a Numeric Character in a String

    Hi Guys,
    I need to replace all the non-numeric characters (including embedded blanks & hyphen) in a string to a numeric character '1'.
    The trailing blanks should not be replaced.
    e.g. "P22233344455566" should be changed to "122233344455566"
    &    "49-1234567           " should be changed to "4911234567          "
    Please help.

    Use [replace|http://help.sap.com/abapdocu_70/en/ABAPREPLACE_IN_PATTERN.htm] with a regular expression to translate any non-numeric character (i.e. any character not between 0 and 9) to 1:
      REPLACE ALL OCCURENCES OF REGEX '[^0-9]' IN value WITH '1'.
    Cheers, harald
    p.s.: In older releases [translate|http://help.sap.com/abapdocu_70/en/ABAPTRANSLATE.htm] would also do the trick, but is more lengthy, because one would need to specify each individual character that should be replaced, e.g.:
      TRANSLATE value TO UPPER CASE.
      TRANSLATE value USING
          ' 1_1-1a1b1c1d1e1f1g1h1i1j1k1l1m1n1o1p1q1r1s1t1u1v1w1x1y1z1'.

Maybe you are looking for