Answered by:
Windows Push Notification Service (WNS) does not accept German characters like ä, ü, ö...

Question
-
Hi,
I have found a very strange behavior of the Windows Push Notification Service (WNS) if I try to update a tile with a message which contains German characters like ä, ü, ö etc.
I am using the latest version of the "Windows Azure Toolkit for Windows 8" for sending the push notification.
Here is the code I am using:
IAccessTokenProvider _tokenProvider = new WnsAccessTokenProvider("...", "...");
var uri = new Uri("...");
ITileWideText09 wideTile = TileContentFactory.CreateTileWideText09();
wideTile.TextHeading.Text = "Test-Paket";
wideTile.TextBodyWrap.Text = "ä";
ITileSquareText02 squareTile = TileContentFactory.CreateTileSquareText02();
squareTile.TextHeading.Text = "Test-Paket";
squareTile.TextBodyWrap.Text = "ä";
wideTile.SquareContent = squareTile;
var result = wideTile.Send(uri, _tokenProvider);When calling wideTile.Send(), I receive a WebException "The request was aborted: The request was canceled." with an inner IOException "Cannot close stream until all bytes are written.".
Here is the callstack:
at System.Net.ConnectStream.CloseInternal(Boolean internalCall, Boolean aborting)
at System.Net.ConnectStream.System.Net.ICloseEx.CloseEx(CloseExState closeState)
at System.Net.ConnectStream.Dispose(Boolean disposing)
at System.IO.Stream.Close()
at System.IO.Stream.Dispose()
at Microsoft.Windows.Samples.Notifications.NotificationSendUtils.Send(Uri channelUri, IAccessTokenProvider accessTokenProvider, String payload, NotificationType type, Nullable`1 secondsTTL, Nullable`1 cache, Nullable`1 requestForStatus, String tag, NotificationPriority priority, Int32 tokenRetry) in c:\WindowsAzure\WATWindows\Libraries\WnsRecipe\WnsRecipe\NotificationSendUtils.cs:line 55I have already tried to HTML escape the character ä with ä but then the character is not unescaped when the tile is shown!
What I am doing wrong?
Thanks in advance!
Bye,
Sebastian
- Edited by we_develop Wednesday, May 30, 2012 4:01 PM
Wednesday, May 30, 2012 4:01 PM
Answers
-
Hey there,
Looks like there's a bug with Azure Toolkit. We'll have a fix and update soon. And once that's available, we'll respond with a link on where to get it.
Thanks,
Darren- Edited by Darren Louie Monday, June 4, 2012 4:36 PM
- Marked as answer by Matt SmallMicrosoft employee, Moderator Monday, June 4, 2012 9:33 PM
Monday, June 4, 2012 4:35 PM -
Hi Sebastian,
I have released an updated version of the WnsRecipe v 0.0.3.2 on NuGet - http://nuget.org/packages/wnsrecipe . This fixes the language issue you were experiencing and also cleans up the namespaces used by the package.
To update your solution to use this the simplest way would be to:
- Right click on your project and select 'Manage NuGet Packages
- Select the Updates tab in the left nav bar
- Select WnsRecipe and press Update
- Update your using statements to
using NotificationsExtensions;
using NotificationsExtensions.TileContent;- Set the appropriate BCP 47 language code for your wideTile.Lang and squareTile.Lang properties
IAccessTokenProvider tokenProvider = new WnsAccessTokenProvider("<your package sid>", "<your client secret>");
var uri = new Uri("<your endpoint uri>");ITileWideText09 wideTile = TileContentFactory.CreateTileWideText09();
wideTile.Lang = "de-DE";
wideTile.TextHeading.Text = "Test-Paket";
wideTile.TextBodyWrap.Text = "ä";
ITileSquareText02 squareTile = TileContentFactory.CreateTileSquareText02();
squareTile.Lang = "de-DE";
squareTile.TextHeading.Text = "Test-Paket";
squareTile.TextBodyWrap.Text = "ä";
wideTile.SquareContent = squareTile;
var result = wideTile.Send(uri, tokenProvider);Kind Regards,
Nick Harris
My Blog: http://www.nickharris.net
- Edited by Nick Harris - MSFTMicrosoft employee Wednesday, June 6, 2012 11:53 PM
- Marked as answer by Rob Caplan [MSFT]Microsoft employee, Moderator Thursday, June 7, 2012 4:39 PM
Wednesday, June 6, 2012 11:50 PM
All replies
-
Hi Sebastian, I am looking into this.
Matt Small - Microsoft Escalation Engineer - Forum Moderator
If my reply answers your question, please mark this post as answered.Friday, June 1, 2012 1:59 PMModerator -
Hey there,
Looks like there's a bug with Azure Toolkit. We'll have a fix and update soon. And once that's available, we'll respond with a link on where to get it.
Thanks,
Darren- Edited by Darren Louie Monday, June 4, 2012 4:36 PM
- Marked as answer by Matt SmallMicrosoft employee, Moderator Monday, June 4, 2012 9:33 PM
Monday, June 4, 2012 4:35 PM -
Hi Darren,
thanks for your feedback! I am looking forward for the fix! :)
Bye,
Sebastian
Monday, June 4, 2012 5:00 PM -
Hi Sebastian,
I have released an updated version of the WnsRecipe v 0.0.3.2 on NuGet - http://nuget.org/packages/wnsrecipe . This fixes the language issue you were experiencing and also cleans up the namespaces used by the package.
To update your solution to use this the simplest way would be to:
- Right click on your project and select 'Manage NuGet Packages
- Select the Updates tab in the left nav bar
- Select WnsRecipe and press Update
- Update your using statements to
using NotificationsExtensions;
using NotificationsExtensions.TileContent;- Set the appropriate BCP 47 language code for your wideTile.Lang and squareTile.Lang properties
IAccessTokenProvider tokenProvider = new WnsAccessTokenProvider("<your package sid>", "<your client secret>");
var uri = new Uri("<your endpoint uri>");ITileWideText09 wideTile = TileContentFactory.CreateTileWideText09();
wideTile.Lang = "de-DE";
wideTile.TextHeading.Text = "Test-Paket";
wideTile.TextBodyWrap.Text = "ä";
ITileSquareText02 squareTile = TileContentFactory.CreateTileSquareText02();
squareTile.Lang = "de-DE";
squareTile.TextHeading.Text = "Test-Paket";
squareTile.TextBodyWrap.Text = "ä";
wideTile.SquareContent = squareTile;
var result = wideTile.Send(uri, tokenProvider);Kind Regards,
Nick Harris
My Blog: http://www.nickharris.net
- Edited by Nick Harris - MSFTMicrosoft employee Wednesday, June 6, 2012 11:53 PM
- Marked as answer by Rob Caplan [MSFT]Microsoft employee, Moderator Thursday, June 7, 2012 4:39 PM
Wednesday, June 6, 2012 11:50 PM -
Hi Nick,
thanks for your fix! Everything works fine now! :)
I have an additional question regarding the language code: Can you give me some details on how the language code is used in WinRT? I am asking because I can successfully send a tile update with german formatted content without setting the language code to "de-DE".
Thanks in advance!
Bye,
Sebastian
Thursday, June 7, 2012 4:37 PM -
The version I downloaded yesterday still had this problem.
here http://watwindows8.codeplex.com/releases/view/84166 still 1.2.4 version is available from April :(
The solution was to change line 284 in BasePushNotification
from:
request.ContentLength = payload.Length;
to:
request.ContentLength = payloadBytes.Length;
Wednesday, June 27, 2012 6:02 PM -
Hi ladeak - updates to the Windows Azure Toolkit for Windows 8 RP are still in progress. In the meantime please utilize the NuGet package to update using the nuget package manager console in visual studio
uninstall-package wnsrecipe
followed by
install-package wnsrecipe
will bring you up to date.
kind regards,
nick harris
My Blog: http://www.nickharris.net
Thursday, June 28, 2012 7:31 AM -
Hi Nick,
Do we have the receipe for normal WCF or c# projects as well.
I want to send notification through service running on my web server.
I try installing the package but it gets me this error
Successfully installed 'WnsRecipe 0.0.3.2'.
Successfully uninstalled 'WnsRecipe 0.0.3.2'.Install failed. Rolling back...
Could not install package 'WnsRecipe 0.0.3.2'. You are trying to install this package into a project that targets '.NETFramework,Version=v3.5', but the package does not contain any assembly references that are compatible with that framework. For more information, contact the package author.Thanks,
Chandan
Chandan Mahajan
Friday, July 6, 2012 12:18 PM