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:
parent
b30ae76c17
commit
81fe4a6e4a
@ -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>
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user