Index: /trunk/include/iprt/env.h
===================================================================
--- /trunk/include/iprt/env.h	(revision 41669)
+++ /trunk/include/iprt/env.h	(revision 41670)
@@ -55,5 +55,9 @@
  * environment array.
  *
- * @returns IPRT status code. Typical error is VERR_NO_MEMORY.
+ * @returns IPRT status code. Typical error is VERR_NO_MEMORY. Another
+ * possible return code is VWRN_NO_TRANSLATION if EnvToClone is RTENV_DEFAULT
+ * and there was no translation available for one environment variable. In
+ * that case, the resulting environment will contain fewer elements than the
+ * original environment.
  *
  * @param   pEnv        Where to store the handle of the new environment block.
Index: /trunk/include/iprt/err.h
===================================================================
--- /trunk/include/iprt/err.h	(revision 41669)
+++ /trunk/include/iprt/err.h	(revision 41670)
@@ -757,4 +757,6 @@
 /** Error while characters translation (unicode and so). */
 #define VERR_NO_TRANSLATION                 (-58)
+/** Error while characters translation (unicode and so). */
+#define VWRN_NO_TRANSLATION                 58
 /** Encountered unicode code point which is reserved for use as endian indicator (0xffff or 0xfffe). */
 #define VERR_CODE_POINT_ENDIAN_INDICATOR    (-59)
Index: /trunk/src/VBox/Runtime/generic/env-generic.cpp
===================================================================
--- /trunk/src/VBox/Runtime/generic/env-generic.cpp	(revision 41669)
+++ /trunk/src/VBox/Runtime/generic/env-generic.cpp	(revision 41670)
@@ -240,14 +240,25 @@
         {
             /* ASSUMES the default environment is in the current codepage. */
-            for (size_t iVar = 0; iVar < cVars; iVar++)
-            {
-                int rc2 = RTStrCurrentCPToUtf8(&pIntEnv->papszEnv[iVar], papszEnv[iVar]);
+            bool fNoTranslation = false;
+            size_t iDst = 0;
+            for (size_t iSrc = 0; iSrc < cVars; iSrc++)
+            {
+                int rc2 = RTStrCurrentCPToUtf8(&pIntEnv->papszEnv[iDst], papszEnv[iSrc]);
+                if (rc2 == VERR_NO_TRANSLATION)
+                {
+                    fNoTranslation = true;
+                    continue;
+                }
                 if (RT_FAILURE(rc2))
                 {
-                    pIntEnv->cVars = iVar;
+                    pIntEnv->cVars = iDst;
                     RTEnvDestroy(pIntEnv);
                     return rc2;
                 }
-            }
+                iDst++;
+            }
+            pIntEnv->cVars = iDst;
+            if (fNoTranslation)
+                rc = VWRN_NO_TRANSLATION;
         }
         else
