Hey All,
I'm having an issue with file encoding in some software I have written to generate subtitles for digital cinemas.
My exe is an MFC dialog based app with unicode enabled.
My problem is that when I encode something here (Australia), it works fine, but when one of my beta testers encodes it (Spain), it isn't correct.
Here is the line of text I am encoding to a UTF-8 xml file:
This is the xml snippet when I encode it (working fine):Code:Prueba de subtitulado: Camión it´s good?. áé*óú äëïöü ¿? ¡!
and this is the result when my beta tester encodes it (faulty)... using the exact same code!:Code:<Text VPosition="23" VAlign="bottom" HPosition="0" HAlign="center">Prueba de subtitulado: Camión</Text> <Text VPosition="17" VAlign="bottom" HPosition="0" HAlign="center">it´s good?. áé*óú</Text> <Text VPosition="11" VAlign="bottom" HPosition="0" HAlign="center">äëïöü ¿? ¡!</Text>
I'm really not sure how to address this, my code to write out the Unicode CString to UTF-8 xml is as follows:Code:<Text HAlign="center" HPosition="0" VAlign="bottom" VPosition="23">Prueba de subtitulado: Camión</Text> <Text HAlign="center" HPosition="0" VAlign="bottom" VPosition="17">it´s good?. áéÃ-óú</Text> <Text HAlign="center" HPosition="0" VAlign="bottom" VPosition="11">äëïöü ¿? ¡!</Text>
Can anyone help me please?Code:CUnicodeFile file; if ( file.Open( finalPathName, CFile::modeWrite | CFile::shareExclusive | CFile::modeCreate ) ) { CString message; file.setType( utf8 ); file.WriteString( csXML, true ); file.Close(); message = _T( "Subtitles exported successfully to folder.\n\nFolder Name: " ); message += uuidString; AfxMessageBox( message ); }
Many thanks,
Steve Q.![]()




Reply With Quote