Pro Hyperlink breaks with special characters

2152
17
Jump to solution
11-27-2019 07:07 AM
MatthewDriscoll
MVP Alum

We have paths and file names with special characters:  L:\Path\MATT'S ADDN BLK 1,2,&3.TIF.  I know this is a terrible thing to do, but it was done long ago before my time here.  My guess is it is due to the special characters.

The paths are stored in an attribute and I am using that as a hyperlink in a custom popup.  The ones which do not have special characters of course open fine.  But I get the following error below on the ones that do. Hitting Yes does nothing.

This is not a problem in using the ArcMap hyperlink (lighting bolt).

   

arcmap equivalency‌ arcmap equivalent

0 Kudos
1 Solution

Accepted Solutions
MatthewDriscoll
MVP Alum
0 Kudos
17 Replies
MarkBockenhauer
Esri Regular Contributor

The single quote is causing the script error.  I don't know of a way to work around this in ArcGIS Pro, other than removing the single quote from the file names.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Depends on how the strings are quoted.  How software interprets a path is another issue, but even microsoft recommends against space and punctuation.  Unix is more forgiving 

p = r'L:\Path\MATT'S ADDN BLK 1,2,&3.TIF'    # ---- single quote raw encoding
  File "<ipython-input-5-7dbd339e92b6>", line 1
    p = r'L:\Path\MATT'S ADDN BLK 1,2,&3.TIF'
                       ^
SyntaxError: invalid syntax


p = r"L:\Path\MATT'S ADDN BLK 1,2,&3.TIF"     # ---- double quote raw encoding

q = p.replace("\\", "/")

q
"L:/Path/MATT'S ADDN BLK 1,2,&3.TIF"   # ---- safe anywhere
MatthewDriscoll
MVP Alum

Thanks Dan!  This fixes the problem.  

Edit:  Seemed like an expression would be the fix, I still get the same error.

Replace($feature.Plat_HL,"\\", "/")

DanPatterson_Retired
MVP Emeritus

you are using arcade, path delimiter replace is for python, no clue how arcade handles paths and unsavory characters

maybe Xander Bakker‌ knows

MatthewDriscoll
MVP Alum

Thanks Dan!  Unfortunately Python is not an option in Pro popups. 

0 Kudos
MarkBockenhauer
Esri Regular Contributor

Matthew,

I tried using Arcade to workaround the link issue, and I think internal Popup window code is interfering.  I have raised this with the team that works on Popups.

For example when a file path is typed in, the popup changes the string

The popup link trips over the ' in the file name.

Mark

MatthewDriscoll
MVP Alum

Customer support thinks it is because of Arcade, not the popup.

"...I was discussing this case with my manager, and we believe the differences seen in hyperlink behavior between ArcMap and ArcGIS Pro relate to how the two programs are coded. ArcMap does not have Arcade integrated into its background processes, while ArcGIS Pro does. This changes how the two programs function at a fundamental level..."

So this leads to why is Arcade the only option for customizing popup's other than getting into the SDK?

0 Kudos
DanPatterson_Retired
MVP Emeritus

Good question... was python used before? (I don't do popups ) or is it some web thing?

0 Kudos
MatthewDriscoll
MVP Alum

Yes VBScript, Python and JScript are all options available for Display Expressions in ArcMap.  

0 Kudos