1
0
mirror of https://github.com/twiglet/cs2j.git synced 2025-01-18 13:15:17 +01:00

Fix encoding for utf-8

This commit is contained in:
Kevin Glynn 2010-06-04 08:27:49 -05:00
parent b30ae76c17
commit 81fe4a6e4a
2 changed files with 30 additions and 1 deletions

View File

@ -9,9 +9,23 @@
<Property>
<Name>UTF8</Name>
<Type>System.Text.Encoding</Type>
<Get>"UTF-8"</Get>
<Get>(new EncodingSupport("UTF-8"))</Get>
<Imports>
<Import>RusticiSoftware.System.Text.EncodingSupport</Import>
</Imports>
</Property>
</Properties>
<Methods>
<Method>
<Return>System.Byte[]</Return>
<Name>GetBytes</Name>
<Params>
<Param>
<Type>System.String</Type>
<Name>s</Name>
</Param>
</Params>
<Java>${this}.getBytes(${s})</Java>
</Method>
</Methods>
</Class>

View File

@ -0,0 +1,15 @@
package RusticiSoftware.System.Text;
import java.io.UnsupportedEncodingException;
public class EncodingSupport {
private String coding = "utf-8";
public EncodingSupport(String coding) {
this.coding = coding;
}
public byte[] getBytes(String input) throws UnsupportedEncodingException {
return input.getBytes(coding);
}
}