SoFunction
Updated on 2025-03-09

Solution to the problem of garbled code downloading of FF browser and IE


package ;
import ;
import ;
import ;
/**
* Encoding the Chinese file name downloaded from file stream output to block the differences in various browser versions
*
* @author xutianlong
* @version [version number, Feb 7, 2013]
* @see [Related Class/Method]
* @since [Product/Module Version]
*/
public class OfficeUtil
{
/**
* Encoding the Chinese file name downloaded from file stream output to block the differences in various browser versions
*/
public static String encodeChineseDownloadFileName(HttpServletRequest request, String pFileName)
{
String agent = ("USER-AGENT");
try
{
if (null != agent && -1 != ("MSIE"))
{
pFileName = (pFileName, "utf-8");
}
else
{
pFileName = new String(("utf-8"), "iso8859-1");
}
}
catch (UnsupportedEncodingException e)
{
();
}
return pFileName;
}
}