From 90135445c8833ff11a31bf37fa09a0b265904b55 Mon Sep 17 00:00:00 2001 From: Carsten Weisse Date: Sun, 18 Dec 2005 22:10:13 +0000 Subject: byte[] <--> String with latin 1 alias ISO-8859-1 --- src/jake2/client/CL.java | 8 ++++---- src/jake2/client/CL_inv.java | 11 ++++++----- src/jake2/client/Key.java | 4 ++-- 3 files changed, 12 insertions(+), 11 deletions(-) (limited to 'src/jake2/client') diff --git a/src/jake2/client/CL.java b/src/jake2/client/CL.java index a4f18bb..51f4dcd 100644 --- a/src/jake2/client/CL.java +++ b/src/jake2/client/CL.java @@ -2,7 +2,7 @@ * CL.java * Copyright (C) 2004 * - * $Id: CL.java,v 1.28 2005-12-18 16:43:51 cawe Exp $ + * $Id: CL.java,v 1.29 2005-12-18 22:10:10 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -720,9 +720,9 @@ public final class CL { // send a disconnect message to the server fin = (char) Defines.clc_stringcmd + "disconnect"; - Netchan.Transmit(Globals.cls.netchan, fin.length(), fin.getBytes()); - Netchan.Transmit(Globals.cls.netchan, fin.length(), fin.getBytes()); - Netchan.Transmit(Globals.cls.netchan, fin.length(), fin.getBytes()); + Netchan.Transmit(Globals.cls.netchan, fin.length(), Lib.stringToBytes(fin)); + Netchan.Transmit(Globals.cls.netchan, fin.length(), Lib.stringToBytes(fin)); + Netchan.Transmit(Globals.cls.netchan, fin.length(), Lib.stringToBytes(fin)); ClearState(); diff --git a/src/jake2/client/CL_inv.java b/src/jake2/client/CL_inv.java index ee7764a..7b771f1 100644 --- a/src/jake2/client/CL_inv.java +++ b/src/jake2/client/CL_inv.java @@ -2,7 +2,7 @@ * CL_fx.java * Copyright (C) 2004 * - * $Id: CL_inv.java,v 1.2 2004-09-22 19:22:08 salomo Exp $ + * $Id: CL_inv.java,v 1.3 2005-12-18 22:10:10 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -31,6 +31,7 @@ import jake2.Defines; import jake2.Globals; import jake2.qcommon.Com; import jake2.qcommon.MSG; +import jake2.util.Lib; import jake2.util.Vargs; /** @@ -58,12 +59,12 @@ public class CL_inv { } } - static void SetStringHighBit(String s) { - byte[] b = s.getBytes(); + static String getHighBitString(String s) { + byte[] b = Lib.stringToBytes(s); for (int i = 0; i < b.length; i++) { b[i] = (byte) (b[i] | 128); } - s = new String(b); + return Lib.bytesToString(b); } /* @@ -131,7 +132,7 @@ public class CL_inv { string = Com.sprintf("%6s %3i %s", new Vargs(3).add(bind).add(Globals.cl.inventory[item]).add( Globals.cl.configstrings[Defines.CS_ITEMS + item])); if (item != selected) - SetStringHighBit(string); + string = getHighBitString(string); else // draw a blinky cursor by the selected item { if (((int) (Globals.cls.realtime * 10) & 1) != 0) diff --git a/src/jake2/client/Key.java b/src/jake2/client/Key.java index 1787262..f896a2c 100644 --- a/src/jake2/client/Key.java +++ b/src/jake2/client/Key.java @@ -2,7 +2,7 @@ * Key.java * Copyright (C) 2003 * - * $Id: Key.java,v 1.11 2005-06-07 12:57:21 hzi Exp $ + * $Id: Key.java,v 1.12 2005-12-18 22:10:12 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -704,7 +704,7 @@ public class Key extends Globals { } else return; key_lines[edit_line][1] = '/'; - byte[] bytes = s.getBytes(); + byte[] bytes = Lib.stringToBytes(s); System.arraycopy(bytes, 0, key_lines[edit_line], 2, bytes.length); key_linepos = bytes.length + 2; key_lines[edit_line][key_linepos++] = ' '; -- cgit v1.2.3