---
title: "输出某种编码的字符串"
author: "icyheart"
date: "2008-10-15T09:22:09Z"
tags: []
slug: "untitled"
draft: false
lastmod: "2009-01-20T11:20:32Z"
id: 252960
url: "https://sucre.iteye.com/blog/252960"
---

```
Public String translate (String str) {
String tempStr = "";
try {
tempStr = new String(str.getBytes("ISO-8859-1"), "GBK");
tempStr = tempStr.trim();
}
catch (Exception e) {
System.err.println(e.getMessage());
}
return tempStr;
}
```