From ae9e157ef4e6a3708489725d4436cc15d273308f Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Thu, 07 Jun 2012 17:30:18 -0400 Subject: [PATCH] Try multiple encodings when working with string blobs (issue 97) --- src/com/gitblit/wicket/pages/BlobPage.java | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/com/gitblit/wicket/pages/BlobPage.java b/src/com/gitblit/wicket/pages/BlobPage.java index 1c43837..fb5a962 100644 --- a/src/com/gitblit/wicket/pages/BlobPage.java +++ b/src/com/gitblit/wicket/pages/BlobPage.java @@ -41,7 +41,8 @@ Repository r = getRepository(); final String blobPath = WicketUtils.getPath(params); - + String [] encodings = GitBlit.getEncodings(); + if (StringUtils.isEmpty(blobPath)) { // blob by objectid @@ -54,7 +55,7 @@ add(new BookmarkablePageLink<Void>("headLink", BlobPage.class).setEnabled(false)); add(new CommitHeaderPanel("commitHeader", objectId)); add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, blobPath, objectId)); - Component c = new Label("blobText", JGitUtils.getStringContent(r, objectId)); + Component c = new Label("blobText", JGitUtils.getStringContent(r, objectId, encodings)); WicketUtils.setCssClass(c, "plainprint"); add(c); } else { @@ -111,7 +112,7 @@ case 1: // PrettyPrint blob text c = new Label("blobText", JGitUtils.getStringContent(r, commit.getTree(), - blobPath)); + blobPath, encodings)); WicketUtils.setCssClass(c, "prettyprint linenums"); break; case 2: @@ -125,14 +126,14 @@ default: // plain text c = new Label("blobText", JGitUtils.getStringContent(r, commit.getTree(), - blobPath)); + blobPath, encodings)); WicketUtils.setCssClass(c, "plainprint"); } add(c); } else { // plain text Label blobLabel = new Label("blobText", JGitUtils.getStringContent(r, - commit.getTree(), blobPath)); + commit.getTree(), blobPath, encodings)); WicketUtils.setCssClass(blobLabel, "plainprint"); add(blobLabel); } -- Gitblit v1.9.1