有问题的文件不在我的控制之下.大多数字节序列都是有效的UTF-8,它不是ISO-8859-1(或其他编码).我想尽我所能提取尽可能多的信息.
该文件包含一些非法字节序列,应替换为替换字符.
这不是一件容易的事,它认为它需要一些关于UTF-8状态机的知识.
Oracle有一个包装器可以满足我的需求:
UTF8ValidationFilter javadoc
是否有类似的东西(商业或免费软件)?
谢谢 -
喜剧
解:
final BufferedInputStream in = new BufferedInputStream(istream);
final CharsetDecoder charsetDecoder = StandardCharsets.UTF_8.newDecoder();
charsetDecoder.onMalformedInput(CodingErrorAction.REPLACE);
charsetDecoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
final Reader inputReader = new InputStreamReader(in, charsetDecoder);
Run Code Online (Sandbox Code Playgroud) 现在,由于Birt 3.7有一种更简单的方法来使用运行时(只是部署jar),为什么没有maven存储库?
Birt包含50多个依赖项,这很荒谬.
你是如何解决这个问题的?
更新:还有
一些帮助(我们并不孤单):https:
//dev.c-ware.de/confluence/display/PUBLIC/Embeding+Birt+into+Application+built+with+Maven
更新11. 2012
年2月在链接的Birt-Exchange论坛中取得了一些进展:
<repositories>
<repository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependency>
<groupId>org.eclipse.birt.runtime</groupId>
<artifactId>org.eclipse.birt.runtime</artifactId>
<version>3.7.1-SNAPSHOT</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
我没有测试过自己.
更新23. 2012年4月
更多运动(这次是在Eclipse方面)
http://www.eclipse.org/forums/index.php/m/845370/
=>期待6月,也许这次.
更新11. 2012年7月
仍然没有来自相关地方的有用的新信息
对于你们中的一些人:http://hartmann-schneevoigt.com/2012/04/04/eclipse-birt-3-7-2-with-maven/可能有帮助.(将jar从eclipse部署到artifactory/nexus,使用更少的efford)
这可能是解决方案:
https://bugs.eclipse.org/bugs/show_bug.cgi? id = 258911(滚动到底部)
<repository>
<id>sonatype-nexus-releases</id>
<name>Sonatype Nexus Releases</name>
<url>https://oss.sonatype.org/content/repositories/releases/</url>
</repository>
Run Code Online (Sandbox Code Playgroud)
最终更新
它在Birt 4.2中正式发布(查找段落'Maven支持')
http://www.eclipse.org/birt/phoenix/project/notable4.2.php
我想在一个表上放置一个触发器,该表将所有插入/更新的数据写入另一个日志文件,以便使用外部工具进行处理.
这是实现这一目标的方法吗?