Escape/encode issues in hyperlink

  • OK...I have image filenames with special characters (created by a system...we can't control that).  I have a code snippet to replace special characters and it is working fine, but for some reason when I use the ="javascript:void(window.open('http://www.<whatever>.com','_blank'))" it doesn't work anymore!!  The url is actually concatenated and calls a custom code section that finds and replaces the special characters [ie., SigPath = SigPath.replace("%","%25")  ].  I have also tried calling encodeURI() and escape() but it says it's not recognized.

    Does anyone know WHY the javascript call would mess with that?

    I finally got one to work and one breaks....

    Thanks!

    Joanie

  • Can you post one of the links that isn't working?  (use dummy data for url bits if these are public and you don't want them viewed by all ).

    Also, when you say that encodeURI and Escape aren't recognized, is that by RS?  Have you tried caling them with fully qualified names?

    Lastly, in your field value, does it look like ="javascript:void(window.open('" & Code.Your_Fn(SomeParm) & "', '_blank'))" ?  ie you're concatenating the url into the whole string value?

     

    Steve.

  • Steve,

    Thanks for replying!  Here's the code in my advanced function for the navigation tab under JUMP TO URL (public info masked).

    =Iif (Fields!STATUS.Value <> "6","javascript:void(window.open('http://xxxxxx/tiffpilot/bin/tiffpilot.exe?FN=" & code.displaylink(Fields!SigFullPath.Value) & "&PD=1','_blank'))","mailto:scconops@xxxxx.com?Subject=Restore%20Request%20For%20Archived%20Document&Body=Please%20restore%20the%20following%20document.%0A%0ACustomer%20Name:%20"& Fields!DOCNAME.Value & "%0A%0AAcct#:%20"& Fields!ACCOUNTNO.value & "%0A%0AObligor#:%20" & Fields!OBLIGORNO.value & "%0A%0ASystem:%20"& Fields!library.Value & "%0A%0ASSN:%20"& fields!SSNO1.Value &"&CC="& (Right(User!UserID,5)) & "@x.xxxxx.com")

    And here's the code from the CODE tab in the report properties:

    Public Function DisplayLink(ByVal mySigPath) As String

     Dim strMapLink As String

     

         Dim _SigCardPath As String = mySigPath.ToString()

     _SigCardPath = _SigCardPath.replace("%", "%25")

     _SigCardPath = _SigCardPath.replace("#", "%23")

     _SigCardPath = _SigCardPath.replace("\", "/")

          strMapLink = _SigCardPath

     Return strMapLink

    End Function

    OK - as far as fully calling it, I'm not sure which class it's in, so no - I haven't tried calling it that way.  I was also reading in the Hitchhiker's RS book that RS doesn't consistently interpret the encoding symbols, so I'm not sure if that's why they SAY to encode it, or if it's still inconsistent after encoding.  I was looking in the rdl file and noticed that it was using UTF-8 encoding, so perhaps that's the issue.  I have tried changing it to ISO- but then it erred out so I'm not where that setting is to say which to use.  Any tips on that?

    <?xml version="1.0" encoding="utf-8"?>

    <Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">

    The window is opening just fine now, it's the encoding problem I'm having now.

    Any help would be GREATLY appreciated!

    Thanks!

    Joanie

  • (i hate it when the window times out and you loose an entire post)

    Can you post the working and not working url's?

    Also, have you tried escaping the ampersands ? ie &amp;

    Steve.

  • Yep...happened to me as well. 

    OK...well. 

     

    http://fzsccolocsw16/tiffpilot/bin/tiffpilot.exe?FN=//fzsccolocsf02/Images/DOCSOPEN/ACCT_DOC/52780/2x%301!.TIF&PD=1  wrong one

    http://xxxxx/tiffpilot/bin/tiffpilot.exe?FN=%5C%5Cxxxxx%5CImages%5CDOCSOPEN%5CACCT_DOC%5C52780%5C2x%25301!.TIF&PD=1 right one

    Navigation tab for JUMP TO URL

    Broken one:

    =Iif (Fields!STATUS.Value <> "6","javascript:void(window.open('http://xxxxx/tiffpilot/bin/tiffpilot.exe?FN=" & code.DisplayLink(Fields!SigFullPath.Value) & "','_blank'))","mailto:scconops@xxxxx?Subject=Restore%20Request%20For%20Archived%20Document&Body=Please%20restore%20the%20following%20document.%0A%0ACustomer%20Name:%20"& Fields!DOCNAME.Value & "%0A%0AAcct#:%20"& Fields!ACCOUNTNO.value & "%0A%0AObligor#:%20" & Fields!OBLIGORNO.value & "%0A%0ASystem:%20"& Fields!library.Value & "%0A%0ASSN:%20"& fields!SSNO1.Value &"&CC="& (Right(User!UserID,5)) & "@x.xxxxxcom")

    Working one:

    =Iif (Fields!STATUS.Value <> "6","http://xxxxx/tiffpilot/bin/tiffpilot.exe?FN=" & code.displaylink(Fields!SigFullPath.Value) & "',"mailto:scconops@xxxxx?Subject=Restore%20Request%20For%20Archived%20Document&Body=Please%20restore%20the%20following%20document.%0A%0ACustomer%20Name:%20"& Fields!DOCNAME.Value & "%0A%0AAcct#:%20"& Fields!ACCOUNTNO.value & "%0A%0AObligor#:%20" & Fields!OBLIGORNO.value & "%0A%0ASystem:%20"& Fields!LIBRARY.Value & "%0A%0ASSN:%20"& fields!SSNO1.Value &"&CC="& (Right(User!UserID,5)) & "@x.xxxxx.com")

    Custom Code for both:

    Public Function DisplayLink(ByVal mySigPath) As String

     Dim strMapLink As String

     

         Dim _SigCardPath As String = mySigPath.ToString()

     

     _SigCardPath = _SigCardPath & "&PD=1"

     _SigCardPath = _SigCardPath.replace("%", "%25")

     _SigCardPath = _SigCardPath.replace("#", "%23")

     _SigCardPath = _SigCardPath.replace("\", "/")

          strMapLink = _SigCardPath

     Return strMapLink

    End Function

    Thanks!

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply