Hi Eddy,
You should not cast the result to varchar before to re-code to wide , the cast
to varchar would try to recode utf-8 to default server narrow charset , thus :
Also you need to set the http charset to utf-8 :
<?vsp
set http_charset='utf-8'; -- >>> sets the http charset to utf-8
foreach (any row in data) do
{
http('<TR>');
http_value (row[0], 'TD');
--- >>> to be removed _res1 := sprintf('%V',cast (row[1] as varchar));
if (isstring (row[1]))
http_value(charset_recode(row[1],'UTF-8','_WIDE_'),'TD'); -- >>> recode the
result to utf-8 to wide if it is a string literal
else
http_value (row[1], 'TD');
http('</TR>');
}
?>
Best Regards,
Mitko
On Jan 4, 2010, at 9:30 PM, Eddy Vanderlinden wrote:
> Hi Hugh,
>
> After changing the way it is described, it unfortunatelly did not change the
> characters. http://fadyart.com/files/details.vsp
>
> I will let fall this property since I don't want to bother anybody more than
> I did already.
>
> Thanks for all the efforts !
>
> Best regards
>
> Eddy
>
> ----- Original Message -----
> From: "Hugh Williams" <[email protected]>
> To: "Eddy Vanderlinden" <[email protected]>
> Cc: <[email protected]>
> Sent: Monday, January 04, 2010 6:45 PM
> Subject: Re: [Virtuoso-users] international characters in vsp pages
>
>
> HI Eddy,
>
> The following code is not correct in your VSP page:
>
> http_value(charset_recode(_res1,'ISO-8859-1','UTF-8'),'TD');
>
> It should be :
>
> http_value(charset_recode(_res1,'UTF-8', '_WIDE_'),'TD');
>
> because the sparql string literals are kept as UTF-8 and http_value needs a
> wide string.
>
> Also the start of the page should have set http_charset='utf-8';
>
> Best Regards
> Hugh Williams
> Professional Services
> OpenLink Software
> Web: http://www.openlinksw.com
> Support: http://support.openlinksw.com
> Forums: http://boards.openlinksw.com/support
> Twitter: http://twitter.com/OpenLink
>
> On 30 Dec 2009, at 09:52, Eddy Vanderlinden wrote:
>
>>
>> Hi Hugh,
>>
>> I don't like it but must admit I'm stuck.
>>
>> In addendum you can find:
>> - http://fadyart.com/files/Screenshot-1.png where the property 'original
>> name' is showing the name in the original language (Sparql interface of
>> the server). The same happens with the Sparql demo facility and iSql when
>> we precede the 'select'-instruction by the http_charset('ISO-8859-1')
>> This is what we would like to obtain.
>> - http://fadyart.com/files/Screenshot.png where the value of property
>> 'original name' has lost his formatting
>> - http://fadyart.com/files/detail.vsp:
>> --Only the first query needs the formatting in the arg row[1]
>> --row[1] contains strings, dates and integers
>> --In line 66 the cast to varchar is necessary because allocating a value
>> to a varchar variable is not sufficient to make the convertion. Line 67 is
>> one of the many charactersets tried.
>> -- lines 72 to 87 show some alternatives wich might have got a result but
>> didn't.
>>
>> The rest is normal coding.
>>
>> Thank you very much in advance for your advice.
>>
>> Best regards
>>
>> Eddy
>>
>>
>>> ----- Original Message ----- From: "Hugh Williams"
>>> <[email protected]>
>>> To: "Eddy Vanderlinden" <[email protected]>
>>> Cc: <[email protected]>
>>> Sent: Tuesday, December 29, 2009 6:17 PM
>>> Subject: Re: [Virtuoso-users] international characters in vsp pages
>>>
>>>
>>>> Hi Eddy,
>>>>
>>>> In VSP pages, if you are using the http_value() function to output you
>>>> probably need to make us of the charset_recode() function to convert the
>>>> returned SPARQL values to UTF8 as detailed at:
>>>>
>>>> http://docs.openlinksw.com/virtuoso/fn_charset_recode.html#%28NULL%29
>>>>
>>>> Using the http() function it will automatically produce output string in
>>>> UTF8 format and is thus better to use, see:
>>>>
>>>> http://docs.openlinksw.com/virtuoso/fn_http.html
>>>>
>>>> I hope this helps, if not please provide some sample VSP code showing
>>>> how
>>>> you are trying to displays the string data ...
>>>>
>>>> Best Regards
>>>> Hugh Williams
>>>> Professional Services
>>>> OpenLink Software
>>>> Web: http://www.openlinksw.com
>>>> Support: http://support.openlinksw.com
>>>> Forums: http://boards.openlinksw.com/support
>>>> Twitter: http://twitter.com/OpenLink
>>>>
>>>> On 29 Dec 2009, at 13:02, Eddy Vanderlinden wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I am struggling with international characters in .vsp pages.
>>>>>
>>>>> As per the instruction, I've put the instruction:
>>>>> <?vsp
>>>>> SET HTTP_CHARSET='ISO-8859-1';
>>>>> ?>
>>>>> on top of the page.
>>>>> This does not work.
>>>>> Even if the instruction is executed right before a SPARQL call, the
>>>>> international characters are not returned.
>>>>>
>>>>> Other information:
>>>>> - iSQL is returning the international characters in the output when the
>>>>> http_charset declation is made right before the "SPARQL select"
>>>>> instruction.
>>>>> - the demo application is always returning the international
>>>>> characters;
>>>>> - sparql interface of the server is always returning the international
>>>>> characters;
>>>>>
>>>>> What I tried unsuccessfully to solve the problem:
>>>>> - Valmode clause like "define output:valmode 'LONG' " in the SPARQL
>>>>> instruction is not working.
>>>>> - Format clause like define output:format "TTL" in the instrustruction
>>>>> is not changing the output format of the characterset.
>>>>> - SQL_UTF8_EXECS parameter is set to 1
>>>>> - http parameters in .ini had an entry Charset = UTF-8. Deleting this
>>>>> would return the default: ISO-8859-1. Restoring with ISO-8859-1 neither
>>>>> did help.
>>>>>
>>>>> If some-one could share his experience with a solution, I would be very
>>>>> grateful.
>>>>>
>>>>> Best regards
>>>>>
>>>>> Eddy
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> This SF.Net email is sponsored by the Verizon Developer Community
>>>>> Take advantage of Verizon's best-in-class app development support
>>>>> A streamlined, 14 day to market process makes app distribution fast and
>>>>> easy
>>>>> Join now and get one step closer to millions of Verizon customers
>>>>> http://p.sf.net/sfu/verizon-dev2dev
>>>>> _______________________________________________
>>>>> Virtuoso-users mailing list
>>>>> [email protected]
>>>>> https://lists.sourceforge.net/lists/listinfo/virtuoso-users
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> This SF.Net email is sponsored by the Verizon Developer Community
>>>> Take advantage of Verizon's best-in-class app development support
>>>> A streamlined, 14 day to market process makes app distribution fast and
>>>> easy
>>>> Join now and get one step closer to millions of Verizon customers
>>>> http://p.sf.net/sfu/verizon-dev2dev
>>>> _______________________________________________
>>>> Virtuoso-users mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/virtuoso-users
>>
>
>
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> _______________________________________________
> Virtuoso-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/virtuoso-users
--
Mitko Iliev
Developer Virtuoso Team
OpenLink Software
http://www.openlinksw.com/virtuoso
Cross Platform Web Services Middleware