Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » my_sql's charset in linux
Re: my_sql's charset in linux [message #5355 is a reply to message #5354] Fri, 15 September 2006 20:23 Go to previous messageGo to previous message
nicomesas is currently offline  nicomesas
Messages: 104
Registered: September 2006
Location: Barcelona, Spain
Experienced Member
Hello,

Already I have test it and seems that it works well.

The problem is that don't know how to change the codification of my system very well. What I have done has been to say to him to the TheIDE that that charset is another one (for example iso8859-15) and at the beginning of the program to establish the codification by hand.

Nico

#include <Core/Core.h>
#include <MySql/MySql.h>

CONSOLE_APP_MAIN
{
  // GetDefaultCharset() ; allways returns CHARSET_UTF8 in my pc
  // If I want to change the codification I must make it in TheIDE and in addition establish 
  // it by hand to see if the result is correct.
  //SetDefaultCharset(CHARSET_ISO8859_15) ;
  // if you uncomment this line, you must change in the ide the default char set, and then
  // the result is ok


  int charSet = GetDefaultCharset() ;
  Cout() << "charset:" <<CharsetName( charSet )  << "\n" ;
  String 	s = "SELECT nombre, refcontable FROM actividades_clases" ; 

  MySqlSession sesion ;
  if (sesion.Connect( "root", "mundoflipi", "skorg_dsrllo_v3", "localhost" ))
  {
    mysql_set_character_set( sesion, "utf8") ;

    Sql q(sesion) ;
    q.Execute(s) ;
    int row = 0;	
    while(q.Fetch())
    {
	String f0 = ToCharset(charSet, (String)q[0], CHARSET_UTF8, '?') ;
	String f1 = ToCharset(charSet, (String)q[1], CHARSET_UTF8, '?') ;
			
	Cout() << "[" << row << "  source]" << (String)q[0] << "  " << (String)q[1] << "\r\n" ;
	Cout() << "[" << row << " encoded]" << f0 << "  " << f1 << "\r\n" ;
	row++ ;
     }
     sesion.Close() ;
   }
}

[Updated on: Fri, 15 September 2006 20:24]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Multiple fields primary key
Next Topic: SqlCtrl error linux
Goto Forum:
  


Current Time: Fri Aug 08 04:42:05 CEST 2025

Total time taken to generate the page: 0.04472 seconds