.net - Silverlight UTF8 Encoder Produces Wacky Output?

Oct 14, 2010

I've been trying to trace down a bug for hours now and it has come down to this:

Dim length as Integer = 300
Dim buffer() As Byte = binaryReader.ReadBytes(length)
Dim text As String = System.Text.Encoding.UTF8.GetString(buffer, 0, buffer.Length)

The problem is the buffer contains 300 bytes but the length of the string 'text' is now 285. When I convert it back to bytes, the length is 521 bytes...The same code is a normal WinForms app works perfectly. The data being read by the binary reader is a UTF8 encoded string. Any ideas why Silverlight is playing funny buggers?

View 1 Replies


ADVERTISEMENT

Create A Program That Produces Random Sentences As Output?

Nov 14, 2010

I'm trying to create a program that produces random sentences as output. With five arrays of strings, one each for nouns, adjectives, verbs, prepositions, and articles. Each array should hold several words for that part of speech. It's supposed to generate sentences by randomly choosing eight words (randomly generating eight array indices) from these arrays, always constructing sentences by using the parts of speech in the following order: article, adjective, noun, verb, preposition, article, adjective, noun.Also, theh code should be properly modularized so that the code to generate each part of speech is not repeated.

View 8 Replies

Port WinForms To Silverlight 2 Or Silverlight 3

Mar 19, 2009

I have a LOB app written in VB.NET with a WinForms front-end and SQL back-end. After many months weighing up how to get onto the Web, I decided last month to use Silverlight 2. Now, Silverlight 3 Beta is out, but there is no end-user runtime.

Does anyone know when the runtime will be available for deployment of SL 3 apps onto client sites?
My dev timeline is about 3 months: should I persist with SL 2 and then u/g to SL3, or jump straight in to SL3?

View 5 Replies

Using Windows Media Encoder SDK To Convert WAV To WMA?

Sep 15, 2009

I have downloaded and installed the Windows Media Encoder and the SDK. I am trying to convert WAV files to WMA files (& vice versa) using VB2005 Pro. I have found plenty of examples on google for working with video but no examples for audio.

View 1 Replies

C# - Use Flush Parameter With Encoder.GetBytes Method?

Oct 4, 2010

This link explains the Encoder.GetBytes Method and there is a bool parameter called flush explained too . The explanation of flush is : true if this encoder can flush its state at the end of the conversion; otherwise, false. To ensure correct termination of a sequence of blocks of encoded bytes, the last call to GetBytes can specify a value of true for flush.but I didn't understand what flush does?

View 3 Replies

VS 2010 Get String/Binary Code/Encoder?

May 22, 2010

I need to know how to crypt that:

Const FileSplit = "@vorfin@"

Cause its appearing on HEX Source.

View 6 Replies

Screen Recorder Using Windows Media Encoder SDK Not Working

May 19, 2009

I was looking up how to make a screen recorder when I ran into a source code that uses Windows Media Encoder SDK. I tried it out and it crashes saying that Data Execution Protection stopped the program. So, I debugged the program and found that when it creates a new instance that this is the cause of the crash. [code]

View 1 Replies

Using The Classes From System.Drawing.Imaging, Esp. Encoder, EncoderParameters

May 5, 2010

Exists a good tutorial or example that shows how to use these classes from namespace System.Drawing.Imaging.

My idea is, to produce Bitmaps and to compress them. I don't know if for my case IO Streaming is important because I don't want to save the bitmap on my hard disk.

View 3 Replies

VS 2010 Optimizing Byte Array To String Encoder

Feb 4, 2011

below is a byte array to string encoder. It uses the yEnc algorithm that is used for Usenet binaries (Usenet only supports text).

Doing a performance analysis in VS2010 shows that this is the most CPU intensive part of the application.

The encoder function is used thousands of times, so I'd like to optimize it as much as possible.

I'm using 'ReDim Preserve' instead of 'Take()ToArray', because I'm targeting .NET Framework 2.0. Is there a more efficient way of getting only a part of a byte array?

vb.net
'Values for yEnc Encoder
Public Structure EncoderValues
Public lChar As Byte

[Code].....

View 15 Replies

Change Browsercontrol To Utf8?

Feb 5, 2009

I wanted to load some utf8 content in browser control but doesnt seem to work!

View 2 Replies

Convert EBCDIC To UTF8?

Dec 22, 2011

I want to convert an ebcdic string to a utf8 string. I use the below online tool to test this, which is very good, for conversion related stuffs.

[URL]

I want to convert £Ë†â€°¢â€°¢¤£â€ ø which is in EBCDIC to UTF8 string, which is thisisutf8 You can use the above link to test.

I refered the below article on how to read EBCDIC data in .net

[URL]

Then I used the same method to read the ebcdic data

Dim encoding As System.Text.Encoding = _
System.Text.Encoding.GetEncoding(37)

However I am not getting the expected data

Here is my code, to get the result into a atring, a.

Dim a As String = System.Text.Encoding.UTF8.GetString(System.Text.Encoding.GetEncoding(37).GetBytes("£Ë†â€°¢â€°¢¤£â€ ø"))

View 1 Replies

Convert Unicode To UTF8?

Jun 26, 2011

how can i convert Unicode to UTF8

how can i conevrt Unicode to ANSI

(VS 2010)


This is for a forum login.

i'm trying to make a login for a forum but if a user contains special char in his name it won't work..

so i thought of converting them to Unicode and convert them to ansi and try loging...

View 4 Replies

Program That Record My Screen Desktop Using Windows Media Encoder

Apr 20, 2012

I have made a small program that record my screen desktop using windows media encoder.

The recording is working good. but wen I start record I can not open any folder in the desktop by double click.

The is the source code :

CODE:

View 3 Replies

Windows Media Encoder - No Erros But If Run The App Vshost.exe Stops Working

Jun 18, 2010

I'm using this code for encoding with wme.

No erros but if I rn the app vshost.exe stops working.

Its somethignw ith the DEP?

Imports WMEncoderLib

Public Class Form1
Dim WithEvents MyEncoder As WMEncoder
Dim MyProColl As IWMEncProfileCollection

[code]...

View 3 Replies

Convert Text From Mac OS Roman To UTF8?

Sep 28, 2009

I've encountered an incredibly frustrating problem during my work with a function to extract META-data from images.

When reading data from a file created under Windows in any kind och charset there is no problem at all, but when reading from files created under OS X i can't convert it to utf8.

The problem only occurs on chars like 'å','ä', 'ö' and some other chars that i rarely use.

Is there any way of converting chars on-the-fly serverside?

I guess i need a function to determine the actual charset as well.

I've tried numerous ways of converting with HTMLEncode/Decode and URLEncode/Decode without ANY result at all.

View 1 Replies

Mysql Query SET NAMES Utf8?

Apr 23, 2009

i am using MySql with vb.net to insert some data in a MySql table and i am facing a problem with encoding.When i try to insert Greek characters the characters in the database are saved as. I made a research in net and found that a mysql query SET NAMES 'utf8'. Solves the problem. I made an execute command but doesnt work.

[Code]...

View 1 Replies

GIF Encoder Decoder Sample Has Error: 'The Project Type Is Not Supported By This Installation'.

Aug 12, 2009

I have tried to find the sdk ('Windows Software Development Kit') mentioned in the 'GIF Encoder and Decoder Sample', but there are so many SDKs I can't find the one I need. I am using visual Studio 2005 Standard Edition on Windows XP. The language I program in is VB. Can someone point me to the right SDKs for the sample and OS and VS version?

View 3 Replies

.net - Remove Control Chars From UTF8 String?

Dec 21, 2010

i have a VB.NET program that handles the content of documents. The programm handles high volumes of documents as "batch"(>2Million documents;total 1TB volume) Some of this documents may contain control chars or chars like f0e8 [URL]). Is there a easy and especially fast way to remove that chars?(except space,newline,tab,...) If the answer is regex: Has anyone a complete regex for me?

View 2 Replies

Open And Save XML File As Utf8 Encoding?

Feb 23, 2011

I have been working on a project that opens, modifies, then saves an xml file. The problem is that one of the attribute values contains a dash, causing the parser to throw an error when my xml editor application attempts to open the file. I have yet to find a working solution after weeks of searching the web, I tried the the following method for saving the xml file[code]...

View 2 Replies

C# - MailMessage.Body Loses CrLf With Encoding.UTF8

Feb 24, 2011

I had an interesting bug today when sending plain text emails from our system. We format messages like this: -1st something happened blab bla. -2nd something else happened blab blab blaa bla. Today we had an email that looked like this: -1st something happened blab bla. -2nd something else happened blab blab blaa bla $1000.00 -3rd Something happened. So above, we see that we lost the CrLf but only on the message that didn't have a period and ended in 0. I went through the code and found the CrLf is intack up until we send the email. I tracked the code down below, I am guessing it applies to C# as well:

[Code]...

View 2 Replies

Read A String Into A Binary File Encoding.UTF8?

Jan 24, 2012

How could i read a string into a binary file Encoding.UTF8.(the string has a length of 25 bytes)

Using fs As New FileStream (OpenFileDialog1.FileName, FileMode.Open)
fs.Position = 2096
Using br As New BinaryReader (fs)
For x As Int16 = 2 To 25

[code]....

View 4 Replies

Utf 8 - Convert Unicode 8 (UTF8) Into Regular American ASCII?

Jan 7, 2012

I have thing problem here is the debugging outputs

"?uÆ’n74tn5187r&key=6e6e0936c4e6c48be56a72eba8964df0"

should be

"?u=83n74tn5187r&key=6e6e0936c4e6c48be56a72eba8964df0"

[code]....

View 1 Replies

Utf 8 - Function That Will Tell Us Whether 2 Strings Are Equivalent Under UTF8 Unicode Collation?

May 23, 2012

This question is similar to How to emulate MySQLs utf8_general_ci collation in PHP string comparisons but I want the function for vb.net rather than PhP.Recently I make a lot of supposedly unique key.Some of the keys are equivalent under UTF8 unicode collation.For example, look at these 2 key:

byers-street-bistro_38.15-79.07
byers-street-bistro‎_38.15-79.07

If I paste that into front page, and look at the source code you'll see

byers-street-bistro__38.15_-79.07

byers-street-bistro‎__38.15_-79.07

Note: In stack overflow they still look different.I know it's not the same. I guess even in stack exchange it doesn't show. Say I have 1 million such records and I want to test whether 2 string WILL be declared the same by MySQL UTF8 collation. I want to know that before uploading. How do I do that.So vb.net think that those are different keys. When we created mysql query and upload that to database, the database complain it's the same key. Just one complain and the upload of 1 million databases will be stuck.We don't even know what the hell is ‎? Where can we look that up anyway?Anyway, I want a function that when given 2 strings will tell me whether they will count as the same or not.If possible we want a function that convert strings into their most "standard" form.For example, ‎ seems to encode nothing and the function would recoqnize all those nothing character and eliminate that.Is there such thing?So far this is what I do. I need something more comprehensive.

[code]...

View 2 Replies

Commit Changes To Database Produces Error

Feb 27, 2012

So I'm going through a tutorial on how to get stuff in my vb form to update a Access Database. I know, I should be using sql, but Im just learning. Anyways, here is the code..

[Code]...

View 10 Replies

Exact Code Produces Different Results?

Oct 15, 2010

I have this code.

vb
Case Keys.U With Me.TextBox1 Dim selectionStart As Integer = .SelectionStart
Dim

[code].....

View 3 Replies

.net - Render Control To Html Produces A Different String?

Jul 7, 2010

I am trying to render a hyperlink to html. ( etc)

When the page loads it works fine. (and lots 10 links) on the update panel it hits the same function and tries to get another 10 links. I set the navigationURL to something like

"../Folder/Mypage.aspx?498592ghjgfosdfgo"

It is set identically both times(load and updatepanel postback) but when i try to render it to html the second time (on the update panel) it adds "../" to the front so i end up with

"../../Folder/Mypage.aspx?498592ghjgfosdfgo"

The function where it changes here

Public Shared Function RenderControl(ByVal c As Control) As String
Dim sw As New IO.StringWriter
Dim htmlw As New HtmlTextWriter(sw)

[Code]....

View 1 Replies

.net - Session Variable In Class Produces NullReferenceException?

Feb 2, 2012

I have a class with a subroutine as follows:

Public Sub SetPermissions()
If IsNothing(HttpContext.Current.Session) Then
Exit Sub
Else

[code]....

I know that my session variable is not yet set, hence a null value, that's why i'm trying to handle it with IsNothing, but my code still bugs out on me.

View 1 Replies

1 Out Of 700 Custom Controls Produces A Security Exception?

Jul 27, 2009

For some reason one of my controls produces the following excecption error when adding to the VS ToolBox:Request for the permission of type System.Security.Permissions.SecurityPermissions, mscorlib, Verion=2.0.0.0, Culture=neutral etcWe have identified it is this class within the Custom Control but we not sure whyit is erroring

View 2 Replies

Move A PictureBox Produces Incorrect Results?

Feb 17, 2011

Im working on a board game in vb.net. But Ive stumbled on a problem; for some reason Im not getting the correct location reference when I move my picturebox. Let me explain the procedure; First it locates the current position of Red1 with Red1Top and Red1Left, and assigns a number for its position; intCurrentSpot. Then it adds what ever was rolled from the dice intDieA to the current location; intCurrentSpot and the second case statement moves it to the new location. HOWEVER position 11 reads as position 10 and hence gives the user an incorrect reading to where the dice points. Ive checked the numbers over a thousand times and still getting an incorrect reading, what am I doing wrong or can I use something else to get Red1 location?[code]...

View 12 Replies

Split A String With <CR><LF> In It Produces Strange Results?

Mar 4, 2009

I have a string with 3 rows. Each row is ended with <CR><LF>. I have verified this by writing the string to file and open it in notepad++The problem I am having is that I want to split this string into an array. When I split on vbCrLf I get 6 lines with this code:

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved