sqlserver2000简繁体显示的问题 ( 积分: 100 )

  • 主题发起人 主题发起人 piaoping
  • 开始时间 开始时间
P

piaoping

Unregistered / Unconfirmed
GUEST, unregistred user!
sqlserver2000装在繁体版的win2003server上面,里面存的是繁体字,客户端是用delphi写的,繁体的客户端win2000上 Edit 和 DBGrid的内容中如显示正常,简体的客户端win2000上Edit 和 DBGrid的内容中则显示乱码,我公司的客户端电脑有简体也有繁体(大家不要说变态呀,工作需要),请兄弟们帮忙呀解决乱码呀
 
目前我是做简繁两个版本的,看有不有好办法,关注下
 
mo兄弟呀,客户端可以做两个版本,但服务器端总不能也弄两个版本吧?
 
帮忙呀,兄弟们
 
用unicode类型的字段存储nvarchar
 
在d2007下面好像可以解决这个问题
 
大哥,用unicode类型的字段存储nvarchar也不行呀
 
兄弟們,出手呀
 
高手帮忙呀
 
方法一、所有资料用晨曦五笔这类的输入法输入。<br>方法二、在简体系统的区域选项中,在高级页中的非Unicode的程序语言设置为中文(台湾);<br>还不行安装最新的MDAC试试
 
网上一个帖子你参考一下.<br>http://topic.csdn.net/t/20040907/11/3347454.html<br>另附一段代码.主要调用WINDOWS的函数进行参照对比.<br><br>unit&nbsp;GBBIG5Cvt;<br><br>{$Define&nbsp;wt_Multilanguage_Flag}<br><br>interface<br><br>type<br>&nbsp;&nbsp;TWordConvertMethod&nbsp;=&nbsp;procedure&nbsp;(var&nbsp;S:&nbsp;String);<br><br><br>function&nbsp;GBToUnicode(const&nbsp;GBStr:&nbsp;String):&nbsp;WideString;<br>function&nbsp;UnicodeToGB(const&nbsp;WStr:&nbsp;WideString):&nbsp;String;<br><br>function&nbsp;Big5ToUnicode(const&nbsp;BIG5Str:&nbsp;String):&nbsp;WideString;<br>function&nbsp;UnicodeToBig5(const&nbsp;WStr:&nbsp;WideString):&nbsp;String;<br><br>function&nbsp;GBToBig5(const&nbsp;GBStr:&nbsp;String):&nbsp;String;<br>function&nbsp;Big5ToGB(const&nbsp;Big5Str:&nbsp;String):&nbsp;String;<br><br>procedure&nbsp;ClearWordConvertMetods;<br><br>var<br>&nbsp;&nbsp;WordConvert_Big5,<br>&nbsp;&nbsp;WordConvert_GB:&nbsp;&nbsp;TWordConvertMethod;<br><br>implementation<br><br>uses<br>&nbsp;&nbsp;Windows,&nbsp;SysUtils;<br><br>const<br>&nbsp;&nbsp;GBCodePage&nbsp;&nbsp;&nbsp;=&nbsp;936;<br>&nbsp;&nbsp;Big5CodePage&nbsp;=&nbsp;950;<br><br>type<br>&nbsp;&nbsp;TMyDWordRec&nbsp;=&nbsp;packed&nbsp;record<br>&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;Integer&nbsp;of<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0:&nbsp;(Value:&nbsp;DWORD);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1:&nbsp;(Lo,&nbsp;Hi:&nbsp;Word);<br>&nbsp;&nbsp;end;<br><br>procedure&nbsp;ClearWordConvertMetods;<br>begin<br>&nbsp;&nbsp;WordConvert_Big5&nbsp;:=&nbsp;nil;<br>&nbsp;&nbsp;WordConvert_GB&nbsp;&nbsp;&nbsp;:=&nbsp;nil;<br>end;<br><br><br>////////////////////////////////////////////////////////////////////////////////<br>//这几个都是VC中的宏定义,Delphi中没有所以自己写一下?<br>function&nbsp;MAKELCID(const&nbsp;wLanguageID,&nbsp;wSortID:&nbsp;Word):&nbsp;DWORD;<br>var<br>&nbsp;&nbsp;Rec:&nbsp;TMyDWordRec;<br>begin<br>&nbsp;&nbsp;Rec.Lo&nbsp;:=&nbsp;wLanguageID;<br>&nbsp;&nbsp;Rec.Hi&nbsp;:=&nbsp;wSortID;<br>&nbsp;&nbsp;Result&nbsp;:=&nbsp;Rec.Value;<br>end;<br><br><br>function&nbsp;MAKELANGID(const&nbsp;usPrimaryLanguage,&nbsp;usSubLanguage:&nbsp;Word):&nbsp;Word;<br>begin<br>&nbsp;&nbsp;Result&nbsp;:=&nbsp;Word((usSubLanguage&nbsp;shl&nbsp;10))&nbsp;or&nbsp;usPrimaryLanguage;<br>end;<br><br>{<br>function&nbsp;PRIMARYLANGID(lgid&nbsp;:&nbsp;Word)&nbsp;:&nbsp;Word;<br>begin<br>&nbsp;&nbsp;Result&nbsp;:=&nbsp;lgid&nbsp;and&nbsp;$3FF;<br>end;<br><br>function&nbsp;SUBLANGID(lgid&nbsp;:&nbsp;Word)&nbsp;:&nbsp;DWord;<br>begin<br>&nbsp;&nbsp;Result&nbsp;:=&nbsp;lgid&nbsp;shr&nbsp;10;<br>end;<br>}<br>////////////////////////////////////////////////////////////////////////////////<br><br>function&nbsp;ChkErr(iVal:&nbsp;Integer):&nbsp;Integer;<br>begin<br>&nbsp;&nbsp;Result&nbsp;:=&nbsp;iVal;<br>&nbsp;&nbsp;if&nbsp;Result&nbsp;=&nbsp;0&nbsp;then<br>&nbsp;&nbsp;&nbsp;&nbsp;RaiseLastOSError;<br>end;<br><br>function&nbsp;StrToUnicode(const&nbsp;S:&nbsp;String;&nbsp;const&nbsp;CodePage:&nbsp;DWord):&nbsp;WideString;<br>var<br>&nbsp;&nbsp;iLen:&nbsp;Integer;<br>begin<br>&nbsp;&nbsp;iLen&nbsp;:=&nbsp;ChkErr(MultiByteToWideChar(CodePage,&nbsp;0,&nbsp;PChar(S),&nbsp;-1,&nbsp;nil,&nbsp;0));<br>&nbsp;&nbsp;SetLength(Result,&nbsp;iLen&nbsp;-&nbsp;1);<br>&nbsp;&nbsp;ChkErr(MultiByteToWideChar(CodePage,&nbsp;0,&nbsp;PChar(S),&nbsp;-1,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PWideChar(Result),&nbsp;iLen));<br>end;<br><br>function&nbsp;UnicodeToStr(const&nbsp;WStr:&nbsp;WideString;&nbsp;const&nbsp;CodePage:&nbsp;DWord):&nbsp;String;<br>var<br>&nbsp;&nbsp;iLen:&nbsp;Integer;<br>begin<br>&nbsp;&nbsp;iLen&nbsp;:=&nbsp;ChkErr(WideCharToMultiByte(CodePage,&nbsp;0,<br>&nbsp;&nbsp;&nbsp;&nbsp;PWChar(WStr),&nbsp;-1,&nbsp;nil,&nbsp;0,&nbsp;nil,&nbsp;nil));<br>&nbsp;&nbsp;SetLength(Result,&nbsp;iLen&nbsp;-&nbsp;1);<br>&nbsp;&nbsp;ChkErr(WideCharToMultiByte(CodePage,&nbsp;0,&nbsp;PWChar(WStr),&nbsp;-1,&nbsp;PChar(Result),&nbsp;iLen,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nil,&nbsp;nil));<br>end;<br><br>function&nbsp;GBToUnicode(const&nbsp;GBStr:&nbsp;String):&nbsp;WideString;<br>begin<br>&nbsp;&nbsp;Result&nbsp;:=&nbsp;StrToUnicode(GBStr,&nbsp;GBCodePage);<br>end;<br><br>function&nbsp;UnicodeToGB(const&nbsp;WStr:&nbsp;WideString):&nbsp;String;<br>begin<br>&nbsp;&nbsp;Result&nbsp;:=&nbsp;UnicodeToStr(WStr,&nbsp;GBCodePage);<br>end;<br><br>function&nbsp;Big5ToUnicode(const&nbsp;BIG5Str:&nbsp;String):&nbsp;WideString;<br>begin<br>&nbsp;&nbsp;Result&nbsp;:=&nbsp;StrToUnicode(BIG5Str,&nbsp;Big5CodePage);<br>end;<br><br>function&nbsp;UnicodeToBig5(const&nbsp;WStr:&nbsp;WideString):&nbsp;String;<br>begin<br>&nbsp;&nbsp;Result&nbsp;:=&nbsp;UnicodeToStr(WStr,&nbsp;Big5CodePage);<br>end;<br><br>function&nbsp;Big5ToGB(const&nbsp;Big5Str:&nbsp;String):&nbsp;String;<br>var<br>&nbsp;&nbsp;Value:&nbsp;String;<br>&nbsp;&nbsp;iLen:&nbsp;Integer;<br>&nbsp;&nbsp;LocaleID:&nbsp;&nbsp;LCID;<br>&nbsp;&nbsp;S:&nbsp;String;<br>begin<br>&nbsp;&nbsp;if&nbsp;Big5Str&nbsp;=&nbsp;''&nbsp;then<br>&nbsp;&nbsp;&nbsp;&nbsp;exit;<br><br>&nbsp;&nbsp;S&nbsp;:=&nbsp;Big5Str;<br>&nbsp;&nbsp;if&nbsp;Assigned(WordConvert_Big5)&nbsp;then<br>&nbsp;&nbsp;&nbsp;&nbsp;WordConvert_Big5(S);<br><br>&nbsp;&nbsp;//内码的转换<br>&nbsp;&nbsp;Value&nbsp;:=&nbsp;UnicodeToGB(Big5ToUnicode(S));<br><br>&nbsp;&nbsp;//简繁体转换在GB内码下做比较合适,好像简体中文内码中包含繁体字可以一一对应<br>&nbsp;&nbsp;//到Big5<br>&nbsp;&nbsp;LocaleID&nbsp;:=&nbsp;MAKELCID(MAKELANGID(LANG_CHINESE,&nbsp;SUBLANG_CHINESE_SIMPLIFIED),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SORT_CHINESE_PRC);<br>&nbsp;&nbsp;iLen&nbsp;:=&nbsp;ChkErr(LCMapString(LocaleID,&nbsp;LCMAP_SIMPLIFIED_CHINESE,&nbsp;PChar(Value),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-1,&nbsp;&nbsp;nil,&nbsp;0));<br>&nbsp;&nbsp;SetLength(Result,&nbsp;iLen&nbsp;-&nbsp;1);<br>&nbsp;&nbsp;ChkErr(LCMapString(LocaleID,&nbsp;LCMAP_SIMPLIFIED_CHINESE,&nbsp;PChar(Value),&nbsp;-1,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PChar(Result),&nbsp;iLen));<br>end;<br><br>function&nbsp;GBToBig5(const&nbsp;GBStr:&nbsp;String):&nbsp;String;<br>var<br>&nbsp;&nbsp;Value:&nbsp;String;<br>&nbsp;&nbsp;iLen:&nbsp;Integer;<br>&nbsp;&nbsp;LocaleID:&nbsp;&nbsp;LCID;<br>&nbsp;&nbsp;S:&nbsp;String;<br>begin<br>&nbsp;&nbsp;if&nbsp;GBStr&nbsp;=&nbsp;''&nbsp;then<br>&nbsp;&nbsp;&nbsp;&nbsp;exit;<br><br>&nbsp;&nbsp;S&nbsp;:=&nbsp;GBStr;<br><br>&nbsp;&nbsp;if&nbsp;Assigned(WordConvert_GB)&nbsp;then<br>&nbsp;&nbsp;&nbsp;&nbsp;WordConvert_GB(S);<br><br>&nbsp;&nbsp;//简繁体转化GB内码下做比较合适<br>&nbsp;&nbsp;LocaleID&nbsp;:=&nbsp;MAKELCID(MAKELANGID(LANG_CHINESE,&nbsp;SUBLANG_CHINESE_SIMPLIFIED),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SORT_CHINESE_PRC);<br>&nbsp;&nbsp;iLen&nbsp;:=&nbsp;ChkErr(LCMapString(LocaleID,&nbsp;LCMAP_TRADITIONAL_CHINESE,&nbsp;PChar(S),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-1,&nbsp;nil,&nbsp;0));<br>&nbsp;&nbsp;SetLength(Value,&nbsp;iLen&nbsp;-&nbsp;1);<br>&nbsp;&nbsp;ChkErr(LCMapString(LocaleID,&nbsp;LCMAP_TRADITIONAL_CHINESE,&nbsp;PChar(S),&nbsp;-1,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PChar(Value),&nbsp;iLen));<br>&nbsp;&nbsp;Result&nbsp;:=&nbsp;UnicodeToBig5(GBToUnicode(Value));<br>end;<br><br>initialization<br>&nbsp;&nbsp;ClearWordConvertMetods;<br><br>finalization<br><br><br>end.
 
你可以在本地機上裝個簡體中文包或是繁體中文包。這樣差不多行吧。
 

Similar threads

D
回复
0
查看
757
DelphiTeacher的专栏
D
D
回复
0
查看
731
DelphiTeacher的专栏
D
后退
顶部