1.1 --- a/src/share/vm/utilities/utf8.hpp Fri Nov 09 08:36:17 2012 -0800 1.2 +++ b/src/share/vm/utilities/utf8.hpp Mon Nov 12 14:03:53 2012 -0800 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -32,22 +32,32 @@ 1.11 1.12 class UTF8 : AllStatic { 1.13 public: 1.14 - // returns the unicode length of a 0-terminated uft8 string 1.15 - static int unicode_length(const char* uft8_str); 1.16 + // returns the unicode length of a 0-terminated utf8 string 1.17 + static int unicode_length(const char* utf8_str); 1.18 1.19 - // returns the unicode length of a non-0-terminated uft8 string 1.20 - static int unicode_length(const char* uft8_str, int len); 1.21 + // returns the unicode length of a non-0-terminated utf8 string 1.22 + static int unicode_length(const char* utf8_str, int len); 1.23 1.24 - // converts a uft8 string to a unicode string 1.25 + // converts a utf8 string to a unicode string 1.26 static void convert_to_unicode(const char* utf8_str, jchar* unicode_buffer, int unicode_length); 1.27 1.28 + // returns the quoted ascii length of a utf8 string 1.29 + static int quoted_ascii_length(const char* utf8_str, int utf8_length); 1.30 + 1.31 + // converts a utf8 string to quoted ascii 1.32 + static void as_quoted_ascii(const char* utf8_str, char* buf, int buflen); 1.33 + 1.34 + // converts a quoted ascii string to utf8 string. returns the original 1.35 + // string unchanged if nothing needs to be done. 1.36 + static const char* from_quoted_ascii(const char* quoted_ascii_string); 1.37 + 1.38 // decodes the current utf8 character, stores the result in value, 1.39 - // and returns the end of the current uft8 chararacter. 1.40 + // and returns the end of the current utf8 chararacter. 1.41 static char* next(const char* str, jchar* value); 1.42 1.43 // decodes the current utf8 character, gets the supplementary character instead of 1.44 // the surrogate pair when seeing a supplementary character in string, 1.45 - // stores the result in value, and returns the end of the current uft8 chararacter. 1.46 + // stores the result in value, and returns the end of the current utf8 chararacter. 1.47 static char* next_character(const char* str, jint* value); 1.48 1.49 // Utility methods 1.50 @@ -79,6 +89,12 @@ 1.51 // in resource area unless a buffer is provided. 1.52 static char* as_utf8(jchar* base, int length); 1.53 static char* as_utf8(jchar* base, int length, char* buf, int buflen); 1.54 + 1.55 + // returns the quoted ascii length of a unicode string 1.56 + static int quoted_ascii_length(jchar* base, int length); 1.57 + 1.58 + // converts a utf8 string to quoted ascii 1.59 + static void as_quoted_ascii(const jchar* base, int length, char* buf, int buflen); 1.60 }; 1.61 1.62 #endif // SHARE_VM_UTILITIES_UTF8_HPP