diff --git a/docs/standard/datetime/working-with-calendars.md b/docs/standard/datetime/working-with-calendars.md index 6b6c6767852d2..6c60061ed4583 100644 --- a/docs/standard/datetime/working-with-calendars.md +++ b/docs/standard/datetime/working-with-calendars.md @@ -74,6 +74,8 @@ The following example changes the calendar used by the Arabic (Saudi Arabia) cul [!code-csharp[Conceptual.Calendars#2](../../../samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/changecalendar2.cs#2)] [!code-vb[Conceptual.Calendars#2](../../../samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.calendars/vb/changecalendar2.vb#2)] +Before writing to the console, it's format is changed to UTF8 so that arabic letters can be displayed correctly. + ## Dates and calendars With the exception of the constructors that include a parameter of type and allow the elements of a date (that is, the month, the day, and the year) to reflect values in a designated calendar, both and values are always based on the Gregorian calendar. This means, for example, that the property returns the year in the Gregorian calendar, and the property returns the day of the month in the Gregorian calendar. diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/changecalendar2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/changecalendar2.cs index 87a600d442d67..b8566c31ecade 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/changecalendar2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/changecalendar2.cs @@ -9,6 +9,7 @@ public static void Main() { DateTime date1 = new DateTime(2011, 6, 20); + Console.OutputEncoding = Encoding.UTF8; DisplayCurrentInfo(); // Display the date using the current culture and calendar. Console.WriteLine(date1.ToString("d"));