Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
30
Question by jashan · Jan 14, 2011 at 10:49 PM · editordatabasestandalonecodepage

CodePage 1252 not supported - works in editor but not in standalone player

I just ran across this very nasty issue and thought I'd share it here for the record - answer coming in a minute ;-)

My game server which accesses a MS SQL Server database and uses System.Data.dll worked fine in the Unity editor but gave me nasty exceptions when trying to run as standalone:

System.NotSupportedException: CodePage 1252 not supported
  at System.Text.Encoding.GetEncoding (Int32 codepage) [0x00000] in <filename unknown>:0 
  at Mono.Data.Tds.TdsCharset.GetEncodingFromLCID (Int32 lcid) [0x00000] in <filename unknown>:0 
  at Mono.Data.Tds.TdsCharset.GetEncodingFromLCID (System.Byte[] collation) [0x00000] in <filename unknown>:0 
  at Mono.Data.Tds.TdsCharset.GetEncoding (System.Byte[] collation) [0x00000] in <filename unknown>:0 

And later:

System.NullReferenceException: Object reference not set to an instance of an object
  at Mono.Data.Tds.Protocol.TdsConnectionPool.GetConnection () [0x00000] in <filename unknown>:0 
  at System.Data.SqlClient.SqlConnection.Open () [0x00000] in <filename unknown>:0 

What's the problem?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image arkhain · Jan 01, 2017 at 11:18 PM 0
Share

Almost 6 years later : Thanks dude :)

I got an asignment for tomorow and just had this issue.

8 Replies

· Add your reply
  • Sort: 
avatar image
56

Answer by jashan · Jan 14, 2011 at 10:55 PM

The issue here is that I18N.dll and I18N.West.dll are missing in the standalone player. They are available in the editor, though. That's why it's working in the editor but not in the standalone player.

Solution: Put those DLLs into your project (probably best next to System.Data.dll), that way, they will be also available in the standalone player.

You find those DLLs on the Mac in:

Unity ("Show Package Contents") / Contents/Frameworks/Mono/lib/mono/unity

And under Windows in:

C:\Programme\Unity\Editor\Data\Mono\lib\mono\unity

"Programme" might be "Program Files" for you ;-)

NOTE: There's also other I18N ("Internationalization") DLLs available, so if you have trouble with another CodePage, you might have to use one of those in your specific case.

Comment
Add comment · Show 25 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image davebuchhofer · May 04, 2011 at 07:19 PM 0
Share

Thanks! just ran into this.

avatar image Barry · Jul 17, 2011 at 02:52 AM 0
Share

Wow. I just ran into this also and your answer worked for me right off the bat. Hard to imagine how much time your answer probably saved me.

Thank you!!!!!

Barry

avatar image liuqingzhi · Oct 13, 2011 at 10:34 AM 0
Share

Thank U ,this is useful for me too!

avatar image Wolfram · Aug 07, 2012 at 03:24 PM 0
Share

Hm, the "next to System.Data.dll" doesn't make sense to me, as I don't see that anywhere in my project (or its folder tree). It's there in the build, but that would mean to always remember to copy the I18-dll's into that after every build, which is extremely error prone.

I solved it for me by copying these into the project's Assets/Plugins folder, as @Cat Burton suggested.

Thanks!

avatar image asafsitner · Mar 09, 2013 at 02:44 PM 0
Share

2 years later, you just saved me a lot of time :)

Show more comments
avatar image
12

Answer by lizardboy79 · Apr 07, 2015 at 09:37 PM

Hey all,

there is a much better solution than copying DLLs. When you do your serialization, make sure to use a Streamwriter with encoding set to "UTF-8" rather than a FileStream. Like this:

 var serializer = new XmlSerializer(typeof(SerializableClass));
 string filename = Application.dataPath + outputpath + outPutFileName;
 var encoding = Encoding.GetEncoding("UTF-8");
 
 using(StreamWriter stream = new StreamWriter( filename, false, encoding))
 {
     serializer.Serialize(stream, this);
 }

NOT:

 using(var stream = new FileStream( Application.dataPath + outputpath + outPutFileName, FileMode.Create))
 {
     serializer.Serialize(stream, this);
 }

No more errors. Cheers!

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image aer0ace · Jul 26, 2015 at 08:50 AM 0
Share

Also worked for me. I like this solution better. Especially since I got this problem on Android, and UTF-8 is definitely what I'd want.

avatar image Gnaarf · Oct 11, 2017 at 03:20 PM 0
Share

Thanks to you both. jashan for bringing up the topic and lizardboy79 for the more elegant solution.

avatar image idbrii · Sep 14, 2018 at 10:47 PM 1
Share

This only works if you can use the StreamReader/StreamWriter. If you're using something like SharpZipLib that only takes streams or filenames and not StreamReaders, then you're out of luck

avatar image
7

Answer by cpuvpubp · Mar 20, 2016 at 04:25 PM

the decision of paulboxer


reshenie.png (44.4 kB)
Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image EvilBozkurt · Nov 08, 2018 at 07:01 PM 1
Share

Thanks dude i fixed my mysql connection problems after build with this method

avatar image
5

Answer by catburton · Jul 19, 2012 at 02:04 PM

Regarding the same situation but for iOS - Putting the DLLs in Assets/Plugins and referencing them from your script should ensure those dll's are included in the build. If when building for iOS you still encounter issues with the DLLs, check your stripping level to ensure the code is not being removed as part of build optimisations:

http://docs.unity3d.com/Documentation/Manual/iphone-playerSizeOptimization.html

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image tbigfish88 · Feb 14, 2017 at 12:55 PM 1
Share

Copying the DLLs works for my windows build, but breaks my WebGL build of the same project.

avatar image jean-noellevels3d tbigfish88 · May 23, 2017 at 02:07 PM 0
Share

$$anonymous$$ee too...

avatar image dclonger jean-noellevels3d · Apr 24, 2019 at 01:55 AM 0
Share

mee too too

Show more comments
avatar image
1

Answer by sk8er8921 · Jul 12, 2016 at 08:08 AM

Copying the .dll's definitely worked but I also had to change the scripting backend in player settings from IL2CPP to Mono2x. I didn't see this mentioned here and it worked for me, so hopefully this helps someone.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image OleksandrMartysh · Apr 21, 2020 at 08:13 PM 0
Share

The same here. I have to use $$anonymous$$ono ins$$anonymous$$d of IL2CPP for some reason...

  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

35 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Low FPS in editor, but normal FPS in standalone 0 Answers

Works in the editor, but not when I publish it.. what's wrong..? 0 Answers

Save game map and upload it to website's database 0 Answers

How can I store player stats online? 0 Answers

Working in the editor but not standalone? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges