@@ -503,22 +503,29 @@ namespace Js
503503#else
504504 library->AddMember (intlNativeInterfaces, Js::PropertyIds::winglob, library->GetFalse ());
505505
506- // when using ICU, we need to call u_init to ensure that ICU is functioning properly before allowing Intl to continue.
507- // u_init will cause the data file to be loaded, and if we don't have enough memory to do so, we can throw OutOfMemory here.
506+ // when using ICU, we can call ulocdata_getCLDRVersion to ensure that ICU is functioning properly before allowing Intl to continue.
507+ // ulocdata_getCLDRVersion will cause the data file to be loaded, and if we don't have enough memory to do so, we can throw OutOfMemory here.
508508 // This is to protect against spurious U_MISSING_RESOURCE_ERRORs and U_FILE_ACCESS_ERRORs coming from early-lifecycle
509509 // functions that require ICU data.
510510 // See OS#16897150, OS#16896933, and others relating to bad statuses returned by GetLocaleData and IsLocaleAvailable
511+ // This was initially attempted using u_init, however u_init does not work with Node's default small-icu data file
512+ // because it contains no converters.
511513 UErrorCode status = U_ZERO_ERROR;
512- u_init (&status);
514+ UVersionInfo cldrVersion;
515+ ulocdata_getCLDRVersion (cldrVersion, &status);
513516 if (status == U_MEMORY_ALLOCATION_ERROR || status == U_FILE_ACCESS_ERROR || status == U_MISSING_RESOURCE_ERROR)
514517 {
515518 // Trace that this happens in case there are build system changes that actually cause the data file to be not found
516- INTL_TRACE (" Could not initialize ICU - u_init returned status %S" , u_errorName (status));
519+ INTL_TRACE (" Could not initialize ICU - ulocdata_getCLDRVersion returned status %S" , u_errorName (status));
517520 Throw::OutOfMemory ();
518521 }
522+ else
523+ {
524+ INTL_TRACE (" Using CLDR version %d.%d.%d.%d" , cldrVersion[0 ], cldrVersion[1 ], cldrVersion[2 ], cldrVersion[3 ]);
525+ }
519526
520- AssertOrFailFastMsg (U_SUCCESS (status), " u_init returned non-OOM failure" );
521- #endif
527+ AssertOrFailFastMsg (U_SUCCESS (status), " ulocdata_getCLDRVersion returned non-OOM failure" );
528+ #endif // else !INTL_WINGLOB
522529
523530 intlNativeInterfaces->SetHasNoEnumerableProperties (true );
524531
0 commit comments