--- a/src/lib/libast/comp/setlocale.c Mon Dec 27 04:23:49 2010
+++ b/src/lib/libast/comp/setlocale.c Fri Jul 22 00:30:31 2011
@@ -19,6 +19,9 @@
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
+/*
+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ */
#pragma prototyped
/*
@@ -2236,6 +2239,24 @@
typedef int (*Isw_f)(wchar_t);
+static int
+wide_wctomb(char* u, wchar_t w)
+{
+ int size = 0;
+
+ if (u)
+ {
+ size = wctomb(u, w);
+ if (size < 0)
+ {
+ *u = (char)(w & 0xff);
+ size = 1;
+ }
+ }
+
+ return size;
+}
+
/*
* called when LC_CTYPE initialized or changes
*/
@@ -2280,7 +2301,7 @@
{
if (!(ast.mb_width = wcwidth))
ast.mb_width = default_wcwidth;
- ast.mb_conv = wctomb;
+ ast.mb_conv = wide_wctomb;
#ifdef mb_state
{
/*