You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2017/08/29 17:07:00 UTC

[jira] [Commented] (PDFBOX-3913) Japanese URI improperly encoded

    [ https://issues.apache.org/jira/browse/PDFBOX-3913?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16145691#comment-16145691 ] 

Tilman Hausherr commented on PDFBOX-3913:
-----------------------------------------

You could also do this:
{code}
String goodURI = new String(actionURI.getURI().getBytes());
{code}
and you would get a "good" result.

According to the PDF specification, the URI component is:
{quote}
The uniform resource identifier to resolve, encoded in 7-bit ASCII.
{quote}
{{new String()}} works when/because the default charset is UTF-8. So IMHO we're doing the right thing.

> Japanese URI improperly encoded
> -------------------------------
>
>                 Key: PDFBOX-3913
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3913
>             Project: PDFBox
>          Issue Type: Bug
>            Reporter: Roman
>         Attachments: business.pdf
>
>
> *PDActionURI.getURI()* function returns bad result for the first link annotation in the attached document [^business.pdf] (this doc works fine in Acrobat Reader).
> We are using PdfBox 2.0.5
> {code}
> //..
> //Iterates by all annotations on the first page of doc, searches for first annotation of type PDAnnotationLink
> //..
>   PDAnnotationLink link = (PDAnnotationLink) annotation;
>   PDAction action = link.getAction();
> //this would return buggy result: http://組匶替綎.com/
> String badURI = ((PDActionURI) action).getURI();
> //although, here fine result is returned: http://経営承継.com/
> String goodURI = String(((COSString)action.getCOSObject().getDictionaryObject("URI")).getBytes());
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org