Login
Log in using an SSO provider:
Fedora Account System
Red Hat Associate
Red Hat Customer
Login using a Red Hat Bugzilla account
Forgot Password
Create an Account
Red Hat Bugzilla – Attachment 771391 Details for
Bug 982891
Default encoding of PO files should be UTF-8 in Windows
Home
New
Search
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh90 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
[?]
This site requires JavaScript to be enabled to function correctly, please enable it.
Example hack to work around the problem on windows.
GettextPullStrategy.java (text/x-csrc), 4.12 KB, created by
Matthew Riek
on 2013-07-10 05:33:03 UTC
(
hide
)
Description:
Example hack to work around the problem on windows.
Filename:
MIME Type:
Creator:
Matthew Riek
Created:
2013-07-10 05:33:03 UTC
Size:
4.12 KB
patch
obsolete
>/* > * Copyright 2011, Red Hat, Inc. and individual contributors > * as indicated by the @author tags. See the copyright.txt file in the > * distribution for a full listing of individual contributors. > * > * This is free software; you can redistribute it and/or modify it > * under the terms of the GNU Lesser General Public License as > * published by the Free Software Foundation; either version 2.1 of > * the License, or (at your option) any later version. > * > * This software is distributed in the hope that it will be useful, > * but WITHOUT ANY WARRANTY; without even the implied warranty of > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > * Lesser General Public License for more details. > * > * You should have received a copy of the GNU Lesser General Public > * License along with this software; if not, write to the Free > * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA > * 02110-1301 USA, or see the FSF site: http://www.fsf.org. > */ > >package org.zanata.client.commands.pull; > >import java.io.File; >import java.io.FileOutputStream; >import java.io.FileWriter; >import java.io.IOException; >import java.io.OutputStreamWriter; >import java.io.Writer; >import java.lang.reflect.InvocationTargetException; >import java.lang.reflect.Method; >import java.nio.charset.Charset; >import java.security.MessageDigest; >import java.security.NoSuchAlgorithmException; > >import org.apache.commons.codec.binary.Hex; >import org.zanata.client.commands.ArgsUtil; >import org.zanata.client.config.LocaleMapping; >import org.zanata.common.io.DigestWriter; >import org.zanata.common.io.FileDetails; >import org.zanata.rest.dto.resource.Resource; >import org.zanata.rest.dto.resource.TranslationsResource; >import org.zanata.util.PathUtil; > >/** > * @author Sean Flanigan <a href="mailto:sflaniga@redhat.com">sflaniga@redhat.com</a> > * > */ >public class GettextPullStrategy extends AbstractGettextPullStrategy >{ > > public GettextPullStrategy(PullOptions opts) > { > super(opts); > } > > @Override > public File getTransFileToWrite(String docName, LocaleMapping localeMapping) > { > String localLocale = localeMapping.getLocalLocale(); > // write the PO file to $docdirname/$locale.po > File transDir = getOpts().getTransDir(); > File docDir = new File(transDir, docName).getParentFile(); > File transFile = new File(docDir, localLocale + ".po"); > return transFile; > } > > private void makeDirs(File dir) throws IOException > { > if (!dir.exists()) > { > if (!dir.mkdirs()) > throw new IOException("unable to create output directory: " + dir); > } > } > > @Override > public FileDetails writeTransFile(Resource doc, String docName, LocaleMapping locMapping, TranslationsResource targetDoc) throws IOException > { > > File transFile = getTransFileToWrite(docName, locMapping); > > makeDirs(transFile.getParentFile()); > MessageDigest md5Digest = null; > try > { > md5Digest = MessageDigest.getInstance("MD5"); > } > catch (NoSuchAlgorithmException e) > { > throw new RuntimeException(e); > } > > FileOutputStream fs = new FileOutputStream(transFile); > OutputStreamWriter oWriter = new OutputStreamWriter(fs, Charset.forName("UTF-8").newEncoder()); > DigestWriter dWriter = new DigestWriter(oWriter, md5Digest); > > // Call the private method 'write' > Method privateWrite; > try { > privateWrite = getPoWriter().getClass().getDeclaredMethod("write", Writer.class, String.class, Resource.class, TranslationsResource.class); > privateWrite.setAccessible(true); > privateWrite.invoke(getPoWriter(), dWriter, "UTF-8", doc, targetDoc); > } catch (NoSuchMethodException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } catch (SecurityException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } catch (IllegalAccessException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } catch (IllegalArgumentException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } catch (InvocationTargetException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > > > // When we are finished writing > FileDetails details = new FileDetails(transFile); > details.setMd5(new String(Hex.encodeHex(md5Digest.digest()))); > return details; > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 982891
: 771391