Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(614)

Unified Diff: utilities.h

Issue 6740005: Handle UCS-2 data coding scheme for SMS messsages. (Closed) Base URL: ssh://gitrw.chromium.org:9222/cromo.git@master
Patch Set: Remove redundant comparison operations Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sms_message_unittest.cc ('k') | utilities.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utilities.h
diff --git a/utilities.h b/utilities.h
index cbec00990cdeb0282e06d5408999968b2da23556..a35aae5127807534909fbbee27af72f6ab55357c 100644
--- a/utilities.h
+++ b/utilities.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -48,7 +48,7 @@ bool HexEsnToDecimal(const std::string& esn_hex, std::string* out);
// GSM-7 is a 7-bit character set, and in SMS messages, the 7-bit
// septets are packed into an array of 8-bit octets.
//
-// The first byte of the input array the length of the converted
+// The first byte of the input array gives the length of the converted
// data in septets, i.e., it is the number of GSM-7 septets that
// will result after the array is unpacked.
std::string Gsm7ToUtf8String(const uint8_t* gsm7);
@@ -59,6 +59,18 @@ std::string Gsm7ToUtf8String(const uint8_t* gsm7);
// octets.
std::vector<uint8_t> Utf8StringToGsm7(const std::string& input);
+// Converts an array of bytes containing text in the UCS-2 encoding
+// into a UTF-8 encoded string.
+//
+// The first byte of the input array gives the length of the converted
+// data in octets. Dividing this number by 2 gives the number of
+// characters in the text.
+std::string Ucs2ToUtf8String(const uint8_t* ucs2);
+
+// Convert a UTF-8 encoded string to a byte array encoding
+// the string as UCS-2.
+std::vector<uint8_t> Utf8StringToUcs2(const std::string& input);
+
// Debugging utility for printing an array of bytes in a nicely
// formatted manner รก la the UNIX hd command.
void DumpHex(const uint8_t* buf, size_t size);
« no previous file with comments | « sms_message_unittest.cc ('k') | utilities.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698