locked
Pasting text into the SampleData.json file in VS Express 2013 RRS feed

  • Question

  • Greetings,

    I have updated my laptop to Windows 8.1, started using the new Visual Studio Express 2013 for Windows to build a Windows store app, and receive the following error message whenever I try to copy code or text from my old Windows app to my new app SampleData.json file in Express 2013.  I can type the same text using the editor in Express 2013, and it works fine, but it will not except outside copied text that is then pasted in.

    I have a large amount of text from my old app that I do not want to retype, so how can I make this outside copied text acceptable and runnable on this new 2013 platform?

    Error message:

    Additional information: No mapping for the Unicode character exists in the target multi-byte code page.

    No mapping for the Unicode character exists in the target multi-byte code page.

    The thread 0xdf0 has exited with code 0 (0x0).

    The program '[6012] MyGodIsReal2.exe' has exited with code -1 (0xffffffff).


    Robert Agans

    Monday, October 21, 2013 8:18 PM

Answers

  • I don't see a problem with that file. It looks like perfectly good UTF-16LE text, and I was able to read it into the File access sample Scenario3 with no changes other than renaming it to Sample.dat and dropping it in the Pictures folder where the sample looks for it.

    I suspect the problem is in the code that actually reads the file. Take a look at the File access sample for an example of how to do read it.

    --Rob


    Friday, November 15, 2013 3:50 AM
    Moderator
  • Hi Rob,

    I think I’m going to have to set this problem aside for the time being, it’s becoming too difficult for me to address.  This is the conclusion I came to when using Windows 8 and I decided to wait until Microsoft made some revisions that are easier to work with, but 8.1 and the new platforms that go with it are still too difficult for me to work with, so I’ll continue to wait for the next one.

    Thanks for all your help!


    Robert Agans

    Tuesday, November 19, 2013 3:18 AM

All replies

  • How exactly are you copying the text in? It sounds like you are getting MBCS text with an incorrect code-page so it doesn't make sense. When you type it in you are getting correct Unicode text. If you open the modified file in Notepad does it appear correctly? What if you then save it as Unicode?

    --Rob

    Tuesday, October 22, 2013 1:00 AM
    Moderator
  • I copied the text from my old store app in VS Express for Windows 8 and pasted it into a Wordperfect WPD file. As you suggested, I found out that it doesn’t look right (it’s a real mess) when I view it in Notepad, and it still looks the same when I save it as a Unicode file and view it again in Notepad.

    I tried to copy a small sample of plain text from my WPD file and save it as a Unicode file, then I viewed it in Notepad and it looked alright, but when I pasted the Unicode file text into the SampleData.json file in Express 2013, it still didn’t work.

    Then I tried to type a short paragraph in this same WPD file, then copied it and pasted it into the SampleData.json file, and it still didn’t work.

    Then I opened a new file in WordPerfect, typed a sentence, copied and pasted it into the SampleData.json file and it worked, but I don’t want to have to retype all my text.  My question is still, how can I use the text from my old app?


    Robert Agans

    Tuesday, October 22, 2013 3:01 AM
  • Once you have the data properly in the Unicode file you should be fine. I'd save it out as Unicode and then import that file directly into Visual Studio without converting back to MBCS.

    --Rob

    Wednesday, October 23, 2013 12:02 AM
    Moderator
  • HI Rob,

    I tried again what you have suggested, but as I mentioned in my last response -- it doesn't work.


    Robert Agans

    Wednesday, October 23, 2013 3:10 AM
  • Hi Robert,

    Don't copy and paste. Save the file as Unicode and then load that.

    If you need more specific help can you please share a sample file saved in Unicode that doesn't work for you.

    --Rob

    Monday, October 28, 2013 8:51 PM
    Moderator
  • Hi Rob,

    I copied the SampleData.json file in my app, and pasted it into a WordPerfect file, and added some content to it.  Then I saved it as a Unicode file and then used the add feature in VS Express to load it into the same folder as the original SampleData.json file.  Then I deleted the original file and removed the file extension txt from the Unicode file.  When I tried to run the app, it through an exception - something about not being able to find the file.  I’ll try to send you the Unicode file that I used.

    I thought maybe there was a way to send you the file, but I can't find one.  It's too much to  copy here, it's 16 pages long.

    Bob


    Robert Agans

    Tuesday, October 29, 2013 3:50 AM
  • Not being able to find the file is a different problem from not being able to load it. From the steps you list it sounds like the file isn't being included in the appxpackage and so isn't available to open at runtime. This wouldn't be related to the contents of the file.

    To fix this, check the file properties in Solution Explorer and make sure it is marked as content and to be copied to the output directory. After building you can look in the project's bin\Debug\AppX directory to make sure it is there.

    It doesn't sound relevant now, but the best way to post files here is to share a link to the file on your SkyDrive.

    --Rob


    Tuesday, October 29, 2013 6:03 PM
    Moderator
  • I followed the steps that you sent, and was able to set the file properties to Build Action = Content; Copy to output Directory = Copy always.  But after building I couldn’t find a reference to SampleData.json in the bin\Debug\AppX directory, but I did find it in the bin\Debug\AppX\DataModel directory. Then I ran the app and I got the following error message.

    An exception of type 'System.Exception' occurred in mscorlib.dll but was not handled in user code

    WinRT information: Unescaped control character at position 114.

    Additional information: Invalid JSON string.

    I uploaded the SampleData.json.txt file to my skydrive and made it public.


    Robert Agans

    Wednesday, October 30, 2013 2:20 AM
  • Hi Robert,

    I'd take a look at the file to see what's at position 114. Make sure that WordPerfect isn't inserting smart-quotes or other control characters as part of the JSON formatting.

    If you would like me to look at this then please provide a link to your file on SkyDrive.

    --Rob

    Thursday, October 31, 2013 10:56 PM
    Moderator
  • Hi Rob,

    I found that there was a question mark at about character position 114 that I thought shouldn’t have been there.  I removed it, but it didn’t make any difference.  I couldn’t see anything else that appeared out of place.

    Below is the link to the file in my skydrive.

    https://skydrive.live.com/?mkt=en-US#cid=FAA0932C61D19725&id=FAA0932C61D19725%21233


    Robert Agans

    Friday, November 1, 2013 2:02 AM
  • Hi Robert,

    Sorry for the delay in looking at this. I cannot see the file on your SkyDrive. Please make sure it is still shared out and the URL is accurate and I'll take a look next week.

    --Rob

    Saturday, November 9, 2013 1:03 AM
    Moderator
  • Hi Rob,

    Sorry about the wrong link, here's the new one.

    https://skydrive.live.com/?mkt=en-US#cid=FAA0932C61D19725&id=FAA0932C61D19725%21740

    Bob


    Robert Agans

    Saturday, November 9, 2013 4:08 AM
  • I don't see a problem with that file. It looks like perfectly good UTF-16LE text, and I was able to read it into the File access sample Scenario3 with no changes other than renaming it to Sample.dat and dropping it in the Pictures folder where the sample looks for it.

    I suspect the problem is in the code that actually reads the file. Take a look at the File access sample for an example of how to do read it.

    --Rob


    Friday, November 15, 2013 3:50 AM
    Moderator
  • Hi Rob,

    I think I’m going to have to set this problem aside for the time being, it’s becoming too difficult for me to address.  This is the conclusion I came to when using Windows 8 and I decided to wait until Microsoft made some revisions that are easier to work with, but 8.1 and the new platforms that go with it are still too difficult for me to work with, so I’ll continue to wait for the next one.

    Thanks for all your help!


    Robert Agans

    Tuesday, November 19, 2013 3:18 AM
  • Hi

    Try followings for the SampleData.json file:

    File -> Advanced Save Option -> Encoding -> Unicode(*** UTF-8) code page 65001

    In my case, I wrote Korean in the SampleData.json file.

    I hope you solve the problem

    Bye.

    YoungTae Han

    Monday, December 30, 2013 4:41 PM
  • Hi YoungTae Han,

    Thank you for your suggestion, but I could not get it to work for me.


    Robert Agans

    Monday, December 30, 2013 8:43 PM