4

I need to generate an URL string for a SSRS report (in order to link it with our CRM software). The report name is in Hebrew. When I send the URL string (with Heb) to Internet Explorer, it doesn't recognize the address because it isn't encoded with Percent-encoding (BTW, it works fine in Firefox). (Sending a URL with English only does work fine that way.)

Anyway, I tried to perform the encoding. I succeeded converting it to URI with UNICODE characters. I need to get the URI in UTF-8. For example, the letter 'י' should be converted into '%d7%99' and not to '%05%D9'.

I included a link: A table with the codes, for your use, if needed.

I need the conversion\encoding function for 1 character. I can build the rest of the script / function for the complete string by myself.

I used a script which used the master.sys.fn_varbintohexstr function. As I said, though, the results aren't proper for IE.

the following:

SELECT master.sys.fn_varbintohexstr((CAST (N'י' AS varbinary)))

will get 0xd905, which I formatted into percent encoding. I should get 'd7 99' instead.

wrap up: I convert an Hebrew character into URI percent encoding. I get a unicode result. I wish > to get a utf8 result. Input = 'י'. Current output = %d9. Wanted output = %d7%99

How can I get those results?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Ido Gal
  • 528
  • 10
  • 26
  • What version of SSRS are you working with? – Cos Callis Apr 08 '12 at 19:51
  • see also https://stackoverflow.com/questions/35200452/compute-md5-hash-of-a-utf8-string/35289890#35289890 for a description of converting a string to UTF-8 encoded bytes. – Ben Oct 11 '17 at 20:38

1 Answers1

0

I have had to deal with a few similar problems and there are two approaches that you may wish to consider; the first is to transform your data into HTML in the query and then render the result as HTML in the RDL, the second is to use JQuery to identify those cells with the incorrect value on the client and then transform that cell (again, using JQuery). The benefit of the second option is that if the server rendering is working on Firefox the transformation overhead doesn't get invoked. The downside is that if you are not rendering the report as HTML it won't work.

For the first option, in the select statement you would need to alter the appropriate column to produce a nvarchar value that looks like

<span style="font=yourfont;" charset="UTF-8"><a href="yourdestination.com" target="_blank">linkname</a></span>

With that string as data you then assign that to the appropriate columns (or cells, as needed)

In the RDL designer drag a placeholder for your field onto the designer and right click the placeholder and select placeholder properties then you can select to display the content as HTML.

Cos Callis
  • 5,051
  • 3
  • 30
  • 57