[MarkLogic Dev General] Encoding

Frank Mortier f.mortier at DSVLAW.BE
Sun Oct 20 23:44:25 PDT 2013


Hi Erik,

It did.

Thanks,
Frank

-----Oorspronkelijk bericht-----
Van: general-bounces at developer.marklogic.com [mailto:general-bounces at developer.marklogic.com] Namens Erik Hennum
Verzonden: Monday, October 14, 2013 4:23 PM
Aan: MarkLogic Developer Discussion
Onderwerp: Re: [MarkLogic Dev General] Encoding

Hi, Frank:

Please see if the xdmp:unquote() on $text helps:

    http://docs.marklogic.com/xdmp:unquote


Erik Hennum

________________________________________
From: general-bounces at developer.marklogic.com [general-bounces at developer.marklogic.com] on behalf of Frank Mortier [f.mortier at DSVLAW.BE]
Sent: Sunday, October 13, 2013 11:15 PM
To: MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] Encoding

Hello,

Some pointers for the following issue would be welcome.

I have a form:
                <form method="post" enctype="multipart/form-data" action="{ xqmvc:link('search', 'submit') }">
                <textarea id="yellow" name="text">{$insert} </textarea>
                <input type="submit" name="submit" value="{le:text("sea.answer")}"/>
                </form>

The $insert variable is xhtml text.

The submit functions is as follows:

declare function submit()
as item()*
{
    xdmp:set-response-encoding("utf-8"),
    xdmp:set-response-content-type("application/xml"),

    let $text := xdmp:url-decode(xdmp:get-request-field("text"))
    let $fileId := fn:concat("test-", (fn:count(fn:collection("test"))+1))
    let $doc := <document>
                    <text>{$text}</text>
                </document>
    let $uri := fn:concat("/test/", $fileId , ".xml")
    let $create :=  xdmp:document-insert($uri, $doc, xdmp:default-permissions(), "test", (), ())
    return
    xdmp:redirect-response(xqmvc:link('search', 'view', ('fileId', $fileId))) };

When the document is inserted in the database it inserts the $text (i.e. xhtml) as follows:

<?xml version="1.0" encoding="UTF-8"?>
<document>
    <fileId>test-19</fileId>
    <text>&lt;p&gt;Choose an example&lt;/p&gt;</text> </document>

What is the solution, as obviously if the document is viewed, the &lt;p&gt and &lt;/p&gt; will be viewed in html as < and >. That is not wat we want.

I am on ML7

Thanks,
Frank



________________________________________
DISCLAIMER -The content of this email is confidential and it is intended for the addressee(s) only. The person who receives this email and who is not the addressee is warned that he is not allowed to copy or distribute its content. If you received this email by mistake, please notify us immediately by telephoning +32 (2) 736 59 90.
_______________________________________________
General mailing list
General at developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
General at developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general



________________________________________
DISCLAIMER -The content of this email is confidential and it is intended for the addressee(s) only. The person who receives this email and who is not the addressee is warned that he is not allowed to copy or distribute its content. If you received this email by mistake, please notify us immediately by telephoning +32 (2) 736 59 90.


More information about the General mailing list