Creat0R
исправил с учетом твоих замечаний:
Код:

Func _StringToJava($sText)
Local $iLen = StringLen($sText), $sChr, $iAsc
Local $tChr = DllStructCreate("wchar["& $iLen+1 &"]"), $sOut=""
Local $tAsc = DllStructCreate("ushort["&$iLen+1 &"]", DllStructGetPtr($tChr))
DllStructSetData($tChr, 1, $sText)
For $i=1 To StringLen($sText)
$sChr = DllStructGetData($tChr,1,$i)
$iAsc = DllStructGetData($tAsc,1,$i)
If $sChr = "\" Or $sChr = "'" Then
$sOut &= "\"& $sChr
ElseIf $iAsc<128 Then
$sOut &= $sChr
Else
$sOut &= "\u"& Hex($iAsc,4)
EndIf
Next
Return $sOut
EndFunc
Func _JavaToString($sText)
Local $sOut="", $aText=StringRegExp($sText,"(\\\\|\\'|\\u[[:xdigit:]]{4}|[[:ascii:]])", 3)
For $i=0 To UBound($aText)-1
Switch StringLen($aText[$i])
Case 1
$sOut &= $aText[$i]
Case 2
$sOut &= StringRight($aText[$i],1)
Case 6
$sOut &= ChrW(Dec(StringRight($aText[$i],4)))
EndSwitch
Next
Return $sOut
EndFunc