Code Pages and Unicode Strings
Another consideration in implementing IPropertySetStorage is how Unicode property names are stored in the property ID 0 (the property name dictionary), which does not use Unicode strings.
Unicode officially has a code page value of 1200. To store Unicode values in the property name dictionary, use a code page value of 1200 for the whole property set (in property ID 1), specified by the absence of the PROPSETFLAG_ANSI flag in IPropertySetStorage::Create. Be aware that this has the side effect of storing all string values in the property set in Unicode. In all code pages, the count found at the start of a VT_LPSTR is a byte count, not a character count. This is necessary to provide for compatibility with earlier-version clients.
The compound file implementation of IPropertySetStorage creates all new property sets completely either in Unicode (code page 1200) or in the current system ANSI code page. This is controlled by the absence or presence of the PROPSETFLAG_ANSI flag in the grfFlags parameter of IPropertySetStorage::Create.
Create and open property sets as Unicode. To implement this, do not set the PROPSETFLAG_ANSI flag in the grfFlags parameter of IPropertySetStorage::Create. Avoid using VT_LPSTR values, and instead use VT_LPWSTR values. When the code page of the property set is Unicode, VT_LPSTR string values are converted to Unicode when stored, and back to multibyte string values when retrieved.
Setting the PROPSETFLAG_ANSI flag as reported through a call to IPropertyStorage::Stat reflects whether the underlying code page is or is not Unicode. Be aware that Property ID 1 can be explicitly read to learn the code page.
You can access Property ID 1 through a call to IPropertyStorage::ReadMultiple. However, it is read-only, and may not be updated with WriteMultiple. Furthermore, it may not be deleted with DeleteMultiple.