Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default pdftotext to UTF-8: Issue 1582 #103

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Hypercube/src/Controller/HypercubeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function get(Request $request)
$this->log->debug("Got Content-Type:", ['type' => $content_type]);

if ($content_type == 'application/pdf') {
$cmd_string = $this->pdftotext_executable . " $args - -";
$cmd_string = $this->pdftotext_executable . " $args -enc UTF-8 - -";
Copy link
Member

@jordandukart jordandukart Aug 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to make sense. Reading through pdftotext's docs any idea why they defaulted to Latin1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went back to look and this appears to be a version issue. Older versions default to Latin1, probably due to not paying attention to Unicode, while the newer versions default to UTF-8.

Oddly, the man pages for a default site say UTF-8 is the default, but running the version flag on it shows an older version that requires the flag.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a peak through about available encodings and what may or may not be available on the OS. Know we've ran into things in PHP where things like LC_ALL and UTF-8 aren't available but I can't seem to find reference to that in the pdftotext context so this gets a 👍 from me.

} else {
$cmd_string = $this->tesseract_executable . " stdin stdout $args";
}
Expand Down